LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - HetArrayConvFunc.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 1 1 100.0 %
Date: 2024-11-06 17:42:47 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //# HetArrayConvFunc.h: Definition for HetArrayConvFunc
       2             : //# Copyright (C) 2008
       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 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  General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU  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_TRANSFORM2_HETARRAYCONVFUNC_H
      29             : #define SYNTHESIS_TRANSFORM2_HETARRAYCONVFUNC_H
      30             : 
      31             : #include <synthesis/TransformMachines2/SimplePBConvFunc.h>
      32             : #include <casacore/casa/Arrays/ArrayFwd.h>
      33             : 
      34             : namespace casacore{
      35             : 
      36             :   template<class T> class ImageInterface;
      37             : 
      38             : }
      39             : 
      40             : namespace casa {
      41             : 
      42             :   // <summary>  A class to support FTMachines get their convolution casacore::Function </summary>
      43             :   
      44             :   // <use visibility=export>
      45             :   // <prerequisite>
      46             :   //   <li> <linkto class=VisBuffer>VisBuffer</linkto> module
      47             :   // </prerequisite>
      48             :   // <etymology>
      49             :   // "HetArray" for Heterogeneous casacore::Array => different dish sizes
      50             :   // "ConvFunc" for Convolution Functions 
      51             :   //  appropriate convfunctions for each pair of antenna generated and cached
      52             :   // </etymology>
      53             :   //
      54             :   // <synopsis> 
      55             :   // FTMachines like WProjection and MosaicFT need convolution functions to 
      56             :   // deal with directional dependent issues...
      57             :   // this class and related ones provide and cache  such functions for re-use 
      58             :   //</synopsis>
      59             :   //Forward declarations
      60             :  namespace vi{class VisBuffer2;}
      61             :  namespace refim{
      62             :   
      63             :   class HetArrayConvFunc : public SimplePBConvFunc
      64             : 
      65             :   {
      66             :   public:
      67             :     HetArrayConvFunc();
      68             :     HetArrayConvFunc(const PBMathInterface::PBClass 
      69             :                      typeToUse, const casacore::String vpTable="");
      70             :     //Constructor from record
      71             :     //if for prediction only no need to recover fluxscale
      72             :     HetArrayConvFunc(const casacore::RecordInterface& rec, casacore::Bool calcFluxscale);
      73             :     virtual ~HetArrayConvFunc();
      74             : 
      75             :     //Returns the convfunctions in the Arrays...the rowMap maps the vb.row 
      76             :     //to the  plane of the convfunc appropriate...chanMap and polMap similarly 
      77             : 
      78             :     virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>& iimage, 
      79             :                                   const vi::VisBuffer2& vb,
      80             :                                     const casacore::Int& convSampling,
      81             :                                   const casacore::Vector<casacore::Double>& visFreq,
      82             :                                     casacore::Array<casacore::Complex>& convFunc,
      83             :                                     casacore::Array<casacore::Complex>& weightConvFunc,
      84             :                                     casacore::Vector<casacore::Int>& convsize,
      85             :                                     casacore::Vector<casacore::Int>& convSupport,
      86             :                                     casacore::Vector<casacore::Int>& polMap, casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Int>& rowMap,
      87             :                                   const casacore::Bool getConjConvFuncs=false,
      88             :                                   const casacore::MVDirection& extraShift=casacore::MVDirection(0.0), const casacore::Bool useExtraShift=casacore::False
      89             :                                                                 );
      90             : 
      91             :     virtual casacore::ImageInterface<casacore::Float>&  getFluxScaleImage();
      92             :     // slice flux scale images 
      93             :     virtual void sliceFluxScale(const casacore::Int npol);
      94             :     //Serialization
      95             :    virtual casacore::Bool toRecord(casacore::RecordInterface& rec);
      96             :    virtual casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec, casacore::Bool calcFluxscale=false);
      97             :    virtual void reset();
      98       71629 :    virtual casacore::String name() {return casacore::String("HetArrayConvFunc");}
      99             :     //----------------------------------------------
     100             :     //Spply phase gradient to convfuncs 5 dim convfuncs expected X,Y, pol, chan, row
     101             :     virtual void rephaseConvFunc(const casacore::ImageInterface<casacore::Complex>& iimage, 
     102             :                                  const vi::VisBuffer2& vb,const casacore::Int& convSampling, casacore::Array<casacore::Complex>& convFunc, 
     103             :                                  casacore::Array<casacore::Complex>& weightConvFunc,const std::vector<casacore::Int>& pmap, const std::vector<casacore::Int>& cmap, const std::vector<casacore::Int>& rmap, const casacore::MVDirection& extraShift, const casacore::Bool useExtraShift);
     104             : 
     105             :     private:
     106             :    void applyGradientToYLine(const casacore::Int iy, casacore::Complex*& convFunctions, 
     107             :                              casacore::Complex*& convWeights, const casacore::Double pixXdir, const casacore::Double pixYdir, 
     108             :                              casacore::Int convSize, const casacore::Int ndishpair, const casacore::Int nchan, const casacore::Int nPol);
     109             :    //same as above except apply phasegradient on selected planes as defined by
     110             :    //pmap, cmap and rmap
     111             :    void applyGradientToYLine(const casacore::Int iy, casacore::Complex*& convFunctions, 
     112             :                              casacore::Complex*& convWeights, const casacore::Double pixXdir, const casacore::Double pixYdir, 
     113             :                              casacore::Int convSize, const casacore::Int ndishpair, const casacore::Int nchan, const casacore::Int nPol, const std::vector<casacore::Int>& pmap, const std::vector<casacore::Int>& cmap, const std::vector<casacore::Int>& rmap);
     114             :    void fillConjConvFunc(const casacore::Vector<casacore::Double>& beamFreqs);
     115             :    casacore::Int conjSupport(const casacore::Vector<casacore::Double>& beamFreqs);
     116             :       casacore::Int factorial(casacore::Int n);
     117             :       // the return value are -1 or false for not in cache yet but pointing direction 
     118             :       //seems to be inside image
     119             :       // 1 if value is cached..we have stopped caching..so it should not return this value
     120             :       // 2 pointing is off image ...thus valid but not useful
     121             :       casacore::Int checkPBOfField(const vi::VisBuffer2& vb, casacore::Vector<casacore::Int>& rowMap, const casacore::MVDirection& extraShift=casacore::MVDirection(0.0), const casacore::Bool useExtraShift=casacore::False);
     122             :       void findAntennaSizes(const vi::VisBuffer2& vb);
     123             :       void supportAndNormalize(casacore::Int plane, casacore::Int convSampling);
     124             :       void supportAndNormalizeLatt(casacore::Int plane, casacore::Int convSampling, casacore::TempLattice<casacore::Complex>& convFuncLat,
     125             :                                    casacore::TempLattice<casacore::Complex>& weightConvFuncLat);
     126             :       void init(const PBMathInterface::PBClass typeToUse);
     127             :       void makerowmap(const vi::VisBuffer2& vb, casacore::Vector<casacore::Int>& rowMap);
     128             :       casacore::Float interpLanczos( const casacore::Double& x , const casacore::Double& y, const casacore::Double& nx, const casacore::Double& ny,   const casacore::Float* data, const casacore::Float a=3);
     129             :       casacore::Float sinc(const casacore::Float x) ;
     130             :       casacore::Array<casacore::Complex> resample(const casacore::Array<casacore::Complex>& inarray, const casacore::Double factor);
     131             :       casacore::Matrix<casacore::Complex> resample2(const casacore::Matrix<casacore::Complex>& inarray, const casacore::Double factor);
     132             :       PBMathInterface::PBClass pbClass_p;
     133             :       //std::map <casacore::String, casacore::Int> convFunctionMap_p;
     134             :       casacore::Vector<casacore::Int64> convFunctionMap_p;
     135             :       casacore::Int64 nDefined_p;
     136             :       std::map<casacore::String, casacore::Int> antDiam2IndexMap_p;
     137             :       casacore::Vector<casacore::Int> antIndexToDiamIndex_p;
     138             :       casacore::Block<casacore::CountedPtr<PBMathInterface> > antMath_p;
     139             :       casacore::Int msId_p;
     140             :       casacore::Int actualConvIndex_p;
     141             :       casacore::Array<casacore::Complex> convFunc_p;
     142             :       casacore::Array<casacore::Complex> weightConvFunc_p;
     143             :       casacore::Array<casacore::Complex> convSave_p;
     144             :       casacore::Array<casacore::Complex> weightSave_p;
     145             :       casacore::Int convSize_p; 
     146             :       casacore::String vpTable_p;
     147             :       casacore::Vector<casacore::Int> convSupport_p;
     148             :       casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctions_p;
     149             :       casacore::Block < casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctionsConjFreq_p;
     150             :       casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convWeights_p;
     151             :       casacore::Block<casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSizes_p;
     152             :       casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p;
     153             : 
     154             :     };
     155             : }; //end of namespace refim
     156             : } // end namespace casa
     157             : #endif

Generated by: LCOV version 1.16