LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - SimplePBConvFunc.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 5 0.0 %
Date: 2024-10-04 18:58:15 Functions: 0 3 0.0 %

          Line data    Source code
       1             : //# SimplePBConvFunc.h: Definition for PixelatedConvFunc
       2             : //# Copyright (C) 2007
       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             : #ifndef SYNTHESIS_SIMPLEPBCONVFUNC_H
      29             : #define SYNTHESIS_SIMPLEPBCONVFUNC_H
      30             : 
      31             : #include <casacore/casa/Arrays/Vector.h>
      32             : #include <synthesis/TransformMachines/PBMathInterface.h>
      33             : #include <casacore/casa/Containers/Block.h>
      34             : #include <casacore/casa/Utilities/CountedPtr.h>
      35             : #include <msvis/MSVis/VisBufferUtil.h>
      36             : #include <synthesis/Utilities/FFT2D.h>
      37             : #include <casacore/casa/Arrays/ArrayFwd.h>
      38             : #include <wcslib/wcsconfig.h>  /** HAVE_SINCOS **/
      39             : 
      40             : #if HAVE_SINCOS
      41             : #define SINCOS(a,s,c) sincos(a,&s,&c)
      42             : #else
      43             : #define SINCOS(a,s,c)                   \
      44             :      s = sin(a);                        \
      45             :      c = cos(a)
      46             : #endif
      47             : 
      48             : 
      49             : namespace casacore{
      50             : 
      51             :   template<class T> class ImageInterface;
      52             :   class CoordinateSystem;
      53             :   class DirectionCoordinate;
      54             : }
      55             : 
      56             : namespace casa{
      57             : 
      58             :   // <summary>  A class to support FTMachines get their convolution casacore::Function </summary>
      59             :   
      60             :   // <use visibility=export>
      61             :   // <prerequisite>
      62             :   //   <li> <linkto class=VisBuffer>VisBuffer</linkto> module
      63             : // </prerequisite>
      64             :   // <etymology>
      65             :   // "Simple" for cases that does not need parallactic angle and or frequency 
      66             :   // dependence ...hence one convolution function per pointing
      67             :   // "PB" for primary beam based convolution function
      68             :   // </etymology>
      69             :   //
      70             :   // <synopsis> 
      71             :   // FTMachines like WProjection and MosaicFT need convolution functions to 
      72             :   // deal with directional dependent issues...
      73             :   // this class and related ones provide and cache  such functions for re-use 
      74             :   //</synopsis>
      75             :   //Forward declarations
      76             :   class VisBuffer;
      77             :   class SkyJones;
      78             : 
      79             :   class SimplePBConvFunc 
      80             :     {
      81             :     public:
      82             :       SimplePBConvFunc();
      83             :       SimplePBConvFunc(const PBMathInterface::PBClass typeToUse);
      84             :       SimplePBConvFunc(const casacore::RecordInterface& rec, casacore::Bool calcFlux_needed);
      85             :       virtual ~SimplePBConvFunc();
      86             :       // Inputs are the image, visbuffer, convSampling and skyjones
      87             :       // findconv return a cached convvolution function appropriate for this 
      88             :       // visbuffer and skyjones ...this one should be superseded 
      89             :       // by the one below and call setSkyJones when necessary
      90           0 :       virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>& , 
      91             :                             const VisBuffer& ,const casacore::Int& ,
      92             :                             SkyJones& ,
      93             :                             casacore::Matrix<casacore::Complex>& , 
      94             :                             casacore::Matrix<casacore::Complex>& , casacore::Int& ,
      95           0 :                                     casacore::Int& ){};
      96             :       
      97             :       ////Returns the convfunctions in the Cubes...the casacore::Matrix rowChanMap maps 
      98             :       // the vb.row and channel 
      99             :       //to the plane of the convfunc appropriate 
     100             :       //when conjugateFreqFuncs=True the the convFunc contains the conjugate frequency convFunctions
     101             :       virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>& iimage, 
     102             :                                     const VisBuffer& vb,
     103             :                                     const casacore::Int& convSampling,
     104             :                                     const casacore::Vector<casacore::Double>& visFreq,
     105             :                                     casacore::Array<casacore::Complex>& convFunc,
     106             :                                     casacore::Array<casacore::Complex>& weightConvFunc,
     107             :                                     casacore::Vector<casacore::Int>& convsize,
     108             :                                     casacore::Vector<casacore::Int>& convSupport,
     109             :                                     casacore::Vector<casacore::Int>& polMap, casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Int>& rowMap, const casacore::Bool conjugateFreqFuncs=false);
     110             :         
     111             :       virtual casacore::ImageInterface<casacore::Float>&  getFluxScaleImage();
     112             :       // slice fluxscale image by npol 
     113             :       virtual void sliceFluxScale(casacore::Int npol);
     114             :       //This is a function to just store the final weight image
     115             :       //as FT machines will share this object ...they can get share this too
     116             :       virtual void setWeightImage(casacore::CountedPtr<casacore::TempImage<casacore::Float> >& wgtimage);
     117             : 
     118             :       virtual void setSkyJones(SkyJones* sj);
     119             : 
     120             :       casacore::Bool findSupport(casacore::Array<casacore::Complex>& /*func*/, casacore::Float& /*threshold*/,casacore::Int& /*origin*/, casacore::Int& /*R*/) 
     121             :       {throw(casacore::AipsError("SimplePBConvFunc::findSupport() not implemented"));};
     122           0 :       virtual casacore::Bool makeAverageResponse(const VisBuffer& /*vb*/, 
     123             :                                        const casacore::ImageInterface<casacore::Complex>& /*image*/,
     124             :                                        casacore::ImageInterface<casacore::Float>& /*theavgPB*/,
     125             :                                        casacore::Bool /*reset=true*/)
     126           0 :       {throw(casacore::AipsError("SimplePBConvFunc::makeAverageRes() called"));};
     127             : 
     128             :       //Serialization
     129             :      virtual  casacore::Bool toRecord(casacore::RecordInterface& outRec);
     130             :       //From record 
     131             :       //set calcfluxneeded to true if flux scale need to be computed
     132             :       virtual casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec, casacore::Bool calcFluxneeded=false);
     133             :       //give possibility to erase history
     134             :       virtual void reset();
     135           0 :       virtual casacore::String name() {return casacore::String("SimplePBConvFunc");}
     136             :     protected:
     137             :       SkyJones* sj_p;
     138             :       casacore::TempImage<casacore::Float> fluxScale_p;
     139             :       casacore::Int nx_p; 
     140             :       casacore::Int ny_p;
     141             :       casacore::Int nchan_p;
     142             :       casacore::Int npol_p;
     143             :       casacore::CoordinateSystem csys_p;
     144             :       casacore::DirectionCoordinate dc_p;
     145             :       casacore::MDirection::Convert pointToPix_p;
     146             :       casacore::MeasFrame pointFrame_p;
     147             :       casacore::MEpoch::Types timeMType_p;
     148             :       casacore::Unit timeUnit_p;
     149             :       casacore::Int directionIndex_p;
     150             :       casacore::MDirection direction1_p;
     151             :       casacore::MDirection direction2_p;
     152             :       casacore::Vector<casacore::Double> thePix_p;
     153             :       casacore::Bool filledFluxScale_p;
     154             :       casacore::Vector<casacore::Bool> doneMainConv_p;
     155             :       casacore::Bool calcFluxScale_p;
     156             :       std::map<casacore::String, casacore::Int> vbConvIndex_p;
     157             :       virtual casacore::Int convIndex(const VisBuffer& vb);
     158             :       std::map<casacore::String, casacore::Int> ant1PointVal_p;
     159             :       casacore::Vector<casacore::MDirection> ant1PointingCache_p;
     160             :       const casacore::MDirection& pointingDirAnt1(const VisBuffer& vb);
     161             :       virtual void storeImageParams(const casacore::ImageInterface<casacore::Complex>& iimage, const VisBuffer& vb);
     162             :       virtual void findUsefulChannels(casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Double>& chanFreqs,  const VisBuffer& vb, const casacore::Vector<casacore::Double>& visFreq);
     163             :       //return the direction pixel corresponding to a direction
     164             :       virtual void toPix(const VisBuffer& vb);
     165             :       FFT2D ft_p;
     166             :       casacore::CountedPtr<casacore::TempImage<casacore::Float> > convWeightImage_p;
     167             :     private:
     168             :       casacore::Bool checkPBOfField(const VisBuffer& vb);
     169             :       void addPBToFlux(const VisBuffer& vb);
     170             :       std::map <casacore::String, casacore::Int> convFunctionMap_p;
     171             :       casacore::Int actualConvIndex_p;
     172             :       PBMathInterface::PBClass pbClass_p;
     173             : 
     174             :       casacore::Matrix<casacore::Complex> convFunc_p;
     175             :       casacore::Matrix<casacore::Complex> weightConvFunc_p;
     176             :       casacore::Matrix<casacore::Complex> convSave_p;
     177             :       casacore::Matrix<casacore::Complex> weightSave_p;
     178             :       casacore::Int convSize_p; 
     179             :       casacore::Int convSupport_p;
     180             :       //These are Arrays of 5 dimension (x, y, npol, nchan, nrow)
     181             :       //Thus every baseline may have its own.
     182             :       casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctions_p;
     183             :       casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convWeights_p;
     184             :       casacore::Block<casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSizes_p;
     185             :       casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p;
     186             :       casacore::Matrix<casacore::Bool> pointingPix_p;
     187             :       VisBufferUtil vbUtil_p;
     188             :       
     189             :     };
     190             : };// end of namespace
     191             : #endif

Generated by: LCOV version 1.16