LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - SimplePBConvFunc.h (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 4 8 50.0 %
Date: 2023-10-25 08:47:59 Functions: 4 6 66.7 %

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

Generated by: LCOV version 1.16