ConvolutionFunction.h

Go to the documentation of this file.
00001 //# ConvolutionFunction.h: Definition for ConvolutionFunction
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef SYNTHESIS_TRANSFORM2_CONVOLUTIONFUNCTION_H
00030 #define SYNTHESIS_TRANSFORM2_CONVOLUTIONFUNCTION_H
00031 
00032 #include <synthesis/TransformMachines2/CFTerms.h>
00033 #include <synthesis/TransformMachines2/CFStore.h>
00034 #include <synthesis/TransformMachines2/CFStore2.h>
00035 #include <synthesis/TransformMachines2/PolOuterProduct.h>
00036 #include <synthesis/TransformMachines2/Utils.h>
00037 #include <images/Images/ImageInterface.h>
00038 #include <images/Images/TempImage.h>
00039 #include <casa/Logging/LogOrigin.h>
00040 #include <casa/Logging/LogSink.h>
00041 #include <casa/Logging/LogIO.h>
00042 #include <casa/Arrays/Vector.h>
00043 #define CF_TYPE Double
00044 
00045 namespace casa{
00046   namespace refim{
00047   // <summary>  
00048   //  The base class to compute convolution functions for convolutional gridding. 
00049   // </summary>
00050   
00051   // <use visibility=export>
00052   // <prerequisite>
00053   // </prerequisite>
00054   // <etymology>
00055   //   Class to encapsulate the convolution function for convolutional gridding.
00056   // </etymology>
00057   //
00058   // <synopsis> Standard method of re-sampling data to or from a
00059   //
00060   //  regular grid is done by convolutional gridding.  This requires a
00061   //  convolution function which a finte support size and well behaved
00062   //  function in the Fourier domain.  For standard gridding, the
00063   //  Prolate Spheroidal function are used.  Convolution functions
00064   //  used in Projection algorithms (like W-Projection, A-Projection,
00065   //  etc. and their combinations) each require potentially different
00066   //  mechanisms to compute.  These are implemented in separate
00067   //  classes in the Synthesis module.  Since these are used in common
00068   //  framework for gridding and de-gridding, these are all derived
00069   //  from a common base class.  ConvolutionFunction (this class) is
00070   //  that base class.
00071   //
00072   //  Most of the methods in this base class are pure virtual.  I.e.,
00073   //  only surviving offsprings (derived classes) of this class will
00074   //  be those that will have the wisdom that they methods represent.
00075   //
00076   // </synopsis>
00077 
00078   class ConvolutionFunction
00079   {
00080   public:
00081     ConvolutionFunction():
00082       nDim(2),logIO_p(), spwChanSelFlag_p(), spwFreqSelection_p(),
00083       computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1)
00084     {};
00085     ConvolutionFunction(Int dim): 
00086       nDim(dim),logIO_p(), spwChanSelFlag_p(), spwFreqSelection_p(),
00087       computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1)
00088     {nDim=dim;};
00089     virtual ~ConvolutionFunction();
00090     
00091     // Set the dimention of the convolution function.
00092     virtual void setDimension(Int n){nDim = n;};
00093 
00094     // Given the pixel co-ordinates and an offset values, this returns
00095     // the value of the convolution function.  This is however not
00096     // used anywhere yet (and is therefore also not a pure virtual
00097     // function).
00098     virtual CF_TYPE getValue(Vector<CF_TYPE>& , Vector<CF_TYPE>& ) {return 0.0;};
00099 
00100     // A support function which, for now, returns and integer ID
00101     // corresponding to the on-sky frequency of the supplied VisBuffer.
00102     virtual int getVisParams(const VisBuffer2& vb,const CoordinateSystem& skyCoord=CoordinateSystem())=0;
00103 
00104     // This method computes the convolution function and the
00105     // convolution function used for gridding the weights (typically
00106     // these are the same) and returns them in the cfs and cfwts
00107     // parameters.  The required information about the image and
00108     // visibility parameters is dervided from the given image and
00109     // VisBuffer objects.  wConvSize is the number of w-term planes
00110     // and pa is the Parallactic Angle in radians for which the
00111     // convolution function(s) are computed.
00112     virtual void makeConvFunction(const ImageInterface<Complex>& image,
00113                                   const VisBuffer2& vb,
00114                                   const Int wConvSize,
00115                                   const CountedPtr<PolOuterProduct>& pop,
00116                                   const Float pa, 
00117                                   const Float dpa, 
00118                                   const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00119                                   const Matrix<Double>& vbFreqSelection,
00120                                   CFStore2& cfs,
00121                                   CFStore2& cfwts,
00122                                   Bool fillCF=True) = 0;
00123     // This method computes the average response function.  This is
00124     // typically image-plane equivalent of the convolution functions,
00125     // averaged over various axis.  The precise averaging will be
00126     // implementation dependent in the derived classes.
00127     virtual Bool makeAverageResponse(const VisBuffer2& vb, 
00128                                      const ImageInterface<Complex>& image,
00129                                      ImageInterface<Float>& theavgPB,
00130                                      Bool reset=True) = 0;
00131     virtual Bool makeAverageResponse(const VisBuffer2& vb, 
00132                                      const ImageInterface<Complex>& image,
00133                                      ImageInterface<Complex>& theavgPB,
00134                                      Bool reset=True) = 0;
00135 
00136     //
00137     virtual void setPolMap(const Vector<Int>& polMap) = 0;
00138     virtual void setSpwSelection(const Cube<Int>& spwChanSelFlag) {spwChanSelFlag_p.assign(spwChanSelFlag);}
00139     virtual void setSpwFreqSelection(const Matrix<Double>& spwFreqSel) {spwFreqSelection_p.assign(spwFreqSel);}
00140     virtual void setRotateCF(const Double& computeCFAngleRad, const Double& rotateOTF) 
00141     {computeCFAngleRad_p=computeCFAngleRad; rotateCFOTFAngleRad_p = rotateOTF;};
00142 
00143     //    virtual void setFeedStokes(const Vector<Int>& feedStokes) = 0;
00144     virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R)=0;
00145     virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& image,
00146                                               const VisBuffer2& vb) = 0;
00147 
00148     // virtual void setParams(const Vector<Int>& polMap, const Vector<Int>& feedStokes)
00149     // {setPolMap(polMap); setFeedStokes(feedStokes);};
00150 
00151     //    virtual void prepareConvFunction(const VisBuffer2& vb, CFStore2& cfs)=0;
00152     virtual void prepareConvFunction(const VisBuffer2& vb, VBRow2CFBMapType& theMap)=0;
00153     virtual Matrix<Int> makeBaselineList(const Vector<Int>& antList);
00154     virtual Int mapAntIDToAntType(const Int& /*ant*/) {return 0;};
00155     virtual void setMiscInfo(const RecordInterface& /*params*/) {};
00156     virtual CountedPtr<CFTerms> getTerm(const String& /*name*/) {return NULL;}
00157   private:
00158     Int nDim;
00159   protected:
00160     LogIO& logIO() {return logIO_p;}
00161     LogIO logIO_p;
00162     Cube<Int> spwChanSelFlag_p;
00163     Matrix<Double> spwFreqSelection_p;
00164     Double computeCFAngleRad_p, rotateCFOTFAngleRad_p;
00165   };
00166   };
00167 };
00168 
00169 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1