LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - ConvolutionFunction.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 9 15 60.0 %
Date: 2024-12-11 20:54:31 Functions: 5 11 45.5 %

          Line data    Source code
       1             : //# ConvolutionFunction.h: Definition for ConvolutionFunction
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2002
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be adressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //#
      27             : //# $Id$
      28             : 
      29             : #ifndef SYNTHESIS_TRANSFORM2_CONVOLUTIONFUNCTION_H
      30             : #define SYNTHESIS_TRANSFORM2_CONVOLUTIONFUNCTION_H
      31             : 
      32             : #include <synthesis/TransformMachines2/CFTerms.h>
      33             : #include <synthesis/TransformMachines2/CFStore.h>
      34             : #include <synthesis/TransformMachines2/CFStore2.h>
      35             : #include <synthesis/TransformMachines2/VB2CFBMap.h>
      36             : #include <synthesis/TransformMachines2/PolOuterProduct.h>
      37             : #include <synthesis/TransformMachines2/PointingOffsets.h>
      38             : #include <synthesis/TransformMachines2/Utils.h>
      39             : #include <casacore/images/Images/ImageInterface.h>
      40             : #include <casacore/images/Images/TempImage.h>
      41             : #include <casacore/casa/Logging/LogOrigin.h>
      42             : #include <casacore/casa/Logging/LogSink.h>
      43             : #include <casacore/casa/Logging/LogIO.h>
      44             : #include <casacore/casa/Arrays/Vector.h>
      45             : #define CF_TYPE casacore::Double
      46             : 
      47             : namespace casa{
      48             :   namespace refim{
      49             :   // <summary>  
      50             :   //  The base class to compute convolution functions for convolutional gridding. 
      51             :   // </summary>
      52             :   
      53             :   // <use visibility=export>
      54             :   // <prerequisite>
      55             :   // </prerequisite>
      56             :   // <etymology>
      57             :   //   Class to encapsulate the convolution function for convolutional gridding.
      58             :   // </etymology>
      59             :   //
      60             :   // <synopsis> Standard method of re-sampling data to or from a
      61             :   //
      62             :   //  regular grid is done by convolutional gridding.  This requires a
      63             :   //  convolution function which a finte support size and well behaved
      64             :   //  function in the Fourier domain.  For standard gridding, the
      65             :   //  Prolate Spheroidal function are used.  Convolution functions
      66             :   //  used in casacore::Projection algorithms (like W-casacore::Projection, A-casacore::Projection,
      67             :   //  etc. and their combinations) each require potentially different
      68             :   //  mechanisms to compute.  These are implemented in separate
      69             :   //  classes in the Synthesis module.  Since these are used in common
      70             :   //  framework for gridding and de-gridding, these are all derived
      71             :   //  from a common base class.  ConvolutionFunction (this class) is
      72             :   //  that base class.
      73             :   //
      74             :   //  Most of the methods in this base class are pure virtual.  I.e.,
      75             :   //  only surviving offsprings (derived classes) of this class will
      76             :   //  be those that will have the wisdom that they methods represent.
      77             :   //
      78             :   // </synopsis>
      79             : 
      80             :   class ConvolutionFunction
      81             :   {
      82             :   public:
      83         291 :     ConvolutionFunction():
      84         291 :       nDim(2),logIO_p(), spwChanSelFlag_p(), spwFreqSelection_p(),
      85         291 :       computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1)
      86         291 :     {};
      87             :     ConvolutionFunction(casacore::Int dim): 
      88             :       nDim(dim),logIO_p(), spwChanSelFlag_p(), spwFreqSelection_p(),
      89             :       computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1)
      90             :     {nDim=dim;};
      91             :     virtual ~ConvolutionFunction();
      92             :     
      93             :     // Set the dimention of the convolution function.
      94           0 :     virtual void setDimension(casacore::Int n){nDim = n;};
      95             : 
      96             :     // Given the pixel co-ordinates and an offset values, this returns
      97             :     // the value of the convolution function.  This is however not
      98             :     // used anywhere yet (and is therefore also not a pure virtual
      99             :     // function).
     100           0 :     virtual CF_TYPE getValue(casacore::Vector<CF_TYPE>& , casacore::Vector<CF_TYPE>& ) {return 0.0;};
     101             : 
     102             :     // A support function which, for now, returns and integer ID
     103             :     // corresponding to the on-sky frequency of the supplied VisBuffer.
     104             :     virtual int getVisParams(const VisBuffer2& vb,const casacore::CoordinateSystem& skyCoord=casacore::CoordinateSystem())=0;
     105             : 
     106             :     // This method computes the convolution function and the
     107             :     // convolution function used for gridding the weights (typically
     108             :     // these are the same) and returns them in the cfs and cfwts
     109             :     // parameters.  The required information about the image and
     110             :     // visibility parameters is dervided from the given image and
     111             :     // VisBuffer objects.  wConvSize is the number of w-term planes
     112             :     // and pa is the Parallactic Angle in radians for which the
     113             :     // convolution function(s) are computed.
     114             :     virtual void makeConvFunction(const casacore::ImageInterface<casacore::Complex>& image,
     115             :                                   const VisBuffer2& vb,
     116             :                                   const casacore::Int wConvSize,
     117             :                                   const casacore::CountedPtr<PolOuterProduct>& pop,
     118             :                                   const casacore::Float pa, 
     119             :                                   const casacore::Float dpa, 
     120             :                                   const casacore::Vector<casacore::Double>& uvScale, const casacore::Vector<casacore::Double>& uvOffset,
     121             :                                   const casacore::Matrix<casacore::Double>& vbFreqSelection,
     122             :                                   CFStore2& cfs,
     123             :                                   CFStore2& cfwts,
     124             :                                   casacore::Bool fillCF=true) = 0;
     125             :     // This method computes the average response function.  This is
     126             :     // typically image-plane equivalent of the convolution functions,
     127             :     // averaged over various axis.  The precise averaging will be
     128             :     // implementation dependent in the derived classes.
     129             :     virtual casacore::Bool makeAverageResponse(const VisBuffer2& vb, 
     130             :                                      const casacore::ImageInterface<casacore::Complex>& image,
     131             :                                      casacore::ImageInterface<casacore::Float>& theavgPB,
     132             :                                      casacore::Bool reset=true) = 0;
     133             :     virtual casacore::Bool makeAverageResponse(const VisBuffer2& vb, 
     134             :                                      const casacore::ImageInterface<casacore::Complex>& image,
     135             :                                      casacore::ImageInterface<casacore::Complex>& theavgPB,
     136             :                                      casacore::Bool reset=true) = 0;
     137             : 
     138             :     //
     139             :     virtual void setPolMap(const casacore::Vector<casacore::Int>& polMap) = 0;
     140          14 :     virtual void setSpwSelection(const casacore::Cube<casacore::Int>& spwChanSelFlag) {spwChanSelFlag_p.assign(spwChanSelFlag);}
     141          14 :     virtual void setSpwFreqSelection(const casacore::Matrix<casacore::Double>& spwFreqSel) {spwFreqSelection_p.assign(spwFreqSel);}
     142          93 :     virtual void setRotateCF(const casacore::Double& computeCFAngleRad, const casacore::Double& rotateOTF) 
     143          93 :     {computeCFAngleRad_p=computeCFAngleRad; rotateCFOTFAngleRad_p = rotateOTF;};
     144             : 
     145             :     //    virtual void setFeedStokes(const casacore::Vector<casacore::Int>& feedStokes) = 0;
     146             :     virtual casacore::Bool findSupport(casacore::Array<casacore::Complex>& func, casacore::Float& threshold,casacore::Int& origin, casacore::Int& R)=0;
     147             :     virtual casacore::Vector<casacore::Double> findPointingOffset(const casacore::ImageInterface<casacore::Complex>& image,
     148             :                                               const VisBuffer2& vb) = 0;
     149             : 
     150             :     // virtual void setParams(const casacore::Vector<casacore::Int>& polMap, const casacore::Vector<casacore::Int>& feedStokes)
     151             :     // {setPolMap(polMap); setFeedStokes(feedStokes);};
     152             : 
     153             :     //    virtual void prepareConvFunction(const VisBuffer2& vb, CFStore2& cfs)=0;
     154             :     //virtual void prepareConvFunction(const VisBuffer2& vb, VBRow2CFBMapType& theMap)=0;
     155             :     virtual void prepareConvFunction(const VisBuffer2& vb, VB2CFBMap& theMap)=0;
     156             :     virtual casacore::Matrix<casacore::Int> makeBaselineList(const casacore::Vector<casacore::Int>& antList);
     157           0 :     virtual casacore::Int mapAntIDToAntType(const casacore::Int& /*ant*/) {return 0;};
     158           0 :     virtual void setMiscInfo(const casacore::RecordInterface& /*params*/) {};
     159           0 :     virtual casacore::CountedPtr<CFTerms> getTerm(const casacore::String& /*name*/) {return NULL;}
     160           0 :     virtual int getOversampling(){return 1;};
     161          93 :     virtual bool isWBAWP() {return false;};
     162             :     // virtual casacore::Vector<casacore::Vector<casacore::Double> > findPointingOffset(const casacore::ImageInterface<casacore::Complex>& image,
     163             :     //                                                            const VisBuffer2& vb, const casacore::Bool& doPointing) = 0;
     164             : 
     165             : 
     166             : 
     167             :   private:
     168             :     casacore::Int nDim;
     169             :   protected:
     170             :     casacore::LogIO& logIO() {return logIO_p;}
     171             :     casacore::LogIO logIO_p;
     172             :     casacore::Cube<casacore::Int> spwChanSelFlag_p;
     173             :     casacore::Matrix<casacore::Double> spwFreqSelection_p;
     174             :     casacore::Double computeCFAngleRad_p, rotateCFOTFAngleRad_p;
     175             :   };
     176             :   } // end namespace refim
     177             : } // end namespace casa
     178             : 
     179             : #endif

Generated by: LCOV version 1.16