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_CONVOLUTIONFUNCTION_H
00030 #define SYNTHESIS_CONVOLUTIONFUNCTION_H
00031 
00032 #include <synthesis/TransformMachines/CFStore.h>
00033 #include <synthesis/TransformMachines/CFStore2.h>
00034 #include <synthesis/TransformMachines/CFTerms.h>
00035 #include <synthesis/TransformMachines/PolOuterProduct.h>
00036 #include <synthesis/TransformMachines/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   // <summary>  
00047   //  The base class to compute convolution functions for convolutional gridding. 
00048   // </summary>
00049   
00050   // <use visibility=export>
00051   // <prerequisite>
00052   // </prerequisite>
00053   // <etymology>
00054   //   Class to encapsulate the convolution function for convolutional gridding.
00055   // </etymology>
00056   //
00057   // <synopsis> Standard method of re-sampling data to or from a
00058   //
00059   //  regular grid is done by convolutional gridding.  This requires a
00060   //  convolution function which a finte support size and well behaved
00061   //  function in the Fourier domain.  For standard gridding, the
00062   //  Prolate Spheroidal function are used.  Convolution functions
00063   //  used in Projection algorithms (like W-Projection, A-Projection,
00064   //  etc. and their combinations) each require potentially different
00065   //  mechanisms to compute.  These are implemented in separate
00066   //  classes in the Synthesis module.  Since these are used in common
00067   //  framework for gridding and de-gridding, these are all derived
00068   //  from a common base class.  ConvolutionFunction (this class) is
00069   //  that base class.
00070   //
00071   //  Most of the methods in this base class are pure virtual.  I.e.,
00072   //  only surviving offsprings (derived classes) of this class will
00073   //  be those that will have the wisdom that they methods represent.
00074   //
00075   // </synopsis>
00076 
00077   class ConvolutionFunction
00078   {
00079   public:
00080     ConvolutionFunction():logIO_p(), computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1) {};
00081     ConvolutionFunction(Int dim): computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1) {nDim=dim;};
00082     virtual ~ConvolutionFunction();
00083     
00084     // Set the dimention of the convolution function.
00085     virtual void setDimension(Int n){nDim = n;};
00086 
00087     // Given the pixel co-ordinates and an offset values, this returns
00088     // the value of the convolution function.  This is however not
00089     // used anywhere yet (and is therefore also not a pure virtual
00090     // function).
00091     virtual CF_TYPE getValue(Vector<CF_TYPE>& , Vector<CF_TYPE>& ) {return 0.0;};
00092 
00093     // A support function which, for now, returns and integer ID
00094     // corresponding to the on-sky frequency of the supplied VisBuffer.
00095     virtual int getVisParams(const VisBuffer& vb,const CoordinateSystem& skyCoord=CoordinateSystem())=0;
00096 
00097     // This method computes the convolution function and the
00098     // convolution function used for gridding the weights (typically
00099     // these are the same) and returns them in the cfs and cfwts
00100     // parameters.  The required information about the image and
00101     // visibility parameters is dervided from the given image and
00102     // VisBuffer objects.  wConvSize is the number of w-term planes
00103     // and pa is the Parallactic Angle in radians for which the
00104     // convolution function(s) are computed.
00105     virtual void makeConvFunction(const ImageInterface<Complex>& image,
00106                                   const VisBuffer& vb,
00107                                   const Int wConvSize,
00108                                   const CountedPtr<PolOuterProduct>& pop,
00109                                   const Float pa, 
00110                                   const Float dpa, 
00111                                   const Vector<Double>& uvScale, const Vector<Double>& uvOffset,
00112                                   const Matrix<Double>& vbFreqSelection,
00113                                   CFStore2& cfs,
00114                                   CFStore2& cfwts,
00115                                   Bool fillCF=True) = 0;
00116     // This method computes the average response function.  This is
00117     // typically image-plane equivalent of the convolution functions,
00118     // averaged over various axis.  The precise averaging will be
00119     // implementation dependent in the derived classes.
00120     virtual Bool makeAverageResponse(const VisBuffer& vb, 
00121                                      const ImageInterface<Complex>& image,
00122                                      ImageInterface<Float>& theavgPB,
00123                                      Bool reset=True) = 0;
00124     virtual Bool makeAverageResponse(const VisBuffer& vb, 
00125                                      const ImageInterface<Complex>& image,
00126                                      ImageInterface<Complex>& theavgPB,
00127                                      Bool reset=True) = 0;
00128 
00129     //
00130     virtual void setPolMap(const Vector<Int>& polMap) = 0;
00131     virtual void setSpwSelection(const Cube<Int>& spwChanSelFlag) {spwChanSelFlag_p.assign(spwChanSelFlag);}
00132     virtual void setSpwFreqSelection(const Matrix<Double>& spwFreqSel) {spwFreqSelection_p.assign(spwFreqSel);}
00133     virtual void setRotateCF(const Double& computeCFAngleRad, const Double& rotateOTF) 
00134     {computeCFAngleRad_p=computeCFAngleRad; rotateCFOTFAngleRad_p = rotateOTF;};
00135 
00136     //    virtual void setFeedStokes(const Vector<Int>& feedStokes) = 0;
00137     virtual Bool findSupport(Array<Complex>& func, Float& threshold,Int& origin, Int& R)=0;
00138     virtual Vector<Double> findPointingOffset(const ImageInterface<Complex>& image,
00139                                               const VisBuffer& vb) = 0;
00140 
00141     // virtual void setParams(const Vector<Int>& polMap, const Vector<Int>& feedStokes)
00142     // {setPolMap(polMap); setFeedStokes(feedStokes);};
00143 
00144     //    virtual void prepareConvFunction(const VisBuffer& vb, CFStore2& cfs)=0;
00145     virtual void prepareConvFunction(const VisBuffer& vb, VBRow2CFBMapType& theMap)=0;
00146     virtual Matrix<Int> makeBaselineList(const Vector<Int>& antList);
00147     virtual Int mapAntIDToAntType(const Int& /*ant*/) {return 0;};
00148     virtual void setMiscInfo(const RecordInterface& /*params*/) {};
00149     virtual CountedPtr<CFTerms> getTerm(const String& /*name*/) {return NULL;}
00150   private:
00151     Int nDim;
00152   protected:
00153     LogIO& logIO() {return logIO_p;}
00154     LogIO logIO_p;
00155     Cube<Int> spwChanSelFlag_p;
00156     Matrix<Double> spwFreqSelection_p;
00157     Double computeCFAngleRad_p, rotateCFOTFAngleRad_p;
00158   };
00159 
00160 };
00161 
00162 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1