LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - AWConvFuncHolder.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 3 0.0 %
Date: 2025-08-21 08:01:32 Functions: 0 1 0.0 %

          Line data    Source code
       1             : 
       2             : //# AWConvFuncHolder.h: Definition for a holder class for conv functions for mosaic with squint and wproject
       3             : //# Copyright (C) 2018-2019
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU General Public License as published by
       8             : //# the Free Software Foundation; either version 3 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      14             : //# License for more details.
      15             : //#
      16             : //# https://www.gnu.org/licenses/
      17             : //#
      18             : //# You should have received a copy of the GNU  General Public License
      19             : //# along with this library; if not, write to the Free Software Foundation,
      20             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      21             : //#
      22             : //# Queries concerning CASA should be submitted at
      23             : //#        https://help.nrao.edu
      24             : //#
      25             : //#        Postal address: CASA Project Manager 
      26             : //#                        National Radio Astronomy Observatory
      27             : //#                        520 Edgemont Road
      28             : //#                        Charlottesville, VA 22903-2475 USA
      29             : //#
      30             : //#
      31             : 
      32             : #ifndef SYNTHESIS_TRANSFORM2_AWCONVFUNCHOLDER_H
      33             : #define SYNTHESIS_TRANSFORM2_AWCONVFUNCHOLDER_H
      34             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      35             : #include <synthesis/TransformMachines2/AWConvFunc.h>
      36             : #include <msvis/MSVis/VisBufferUtil.h>
      37             : namespace casa{ //# namespace casa
      38             : namespace refim{ //#     namespace for refactored imaging code with vi2/vb2
      39             : class AWConvFuncHolder{
      40             :   public:
      41             :   AWConvFuncHolder(const casacore::CoordinateSystem& csys, const int nx, const int ny, 
      42             :                    const bool dosquint=false, const double paInc=2*M_PI, const casacore::String& obs="EVLA", const int& oversamp=4);
      43             :   AWConvFuncHolder(const AWConvFuncHolder& other);
      44             :   AWConvFuncHolder& operator=(const AWConvFuncHolder& other);
      45             :   bool loadConvFromFile();
      46             :   bool saveConvToFile(const casacore::String& filename);
      47             :   //paMAxRange is the maximum -ve and +ve value that pa range 
      48             :   bool addConvFunc(const casacore::Vector<casacore::Double>& freqs, const casacore::Vector<Double>& wVals,  const casacore::Double& paMaxRange);
      49             :   //Get the convFunctions and indexing from a given vb
      50             :   casacore::Array<casacore::Complex>& getConvFunc();
      51             :   casacore::Array<casacore::Complex>& getWeightConvFunc();
      52             :   casacore::Vector<casacore::Int> getConvSizes();
      53             :   casacore::Vector<casacore::Int> getConvSupports();
      54             :   casacore::Vector<Stokes::StokesTypes> getPolVals(){return polVals_p;};
      55             :   casacore::Vector<Double> getFreqVals(){return freqVals_p;};
      56             :   casacore::Vector<Double> getWVals(){return wVals_p;};
      57             :   casacore::Vector<Double> getPAVals() { return paVals_p; };
      58             :   
      59             : 
      60             :   // For the HPG gridder we have to get some specialized version as it cannot load all frequencies and all
      61             :   // w-vals in one go. So do it by spw in the vb
      62             :   // call reset first then call to get the conv funcs and indices
      63             :   void resetHPGConvFuncs(const vi::VisBuffer2& vb);
      64             :   casacore::Array<casacore::Complex>& getConvFuncHPG();
      65             :   casacore::Array<casacore::Complex>& getWeightConvFuncHPG();
      66             :   casacore::Vector<Double> getFreqValsHPG() { return freqValsHPG_p; };
      67             :   casacore::Vector<Double> getWValsHPG() { return wValsHPG_p; };
      68             :   int getOverSampling() { return oversamp_p; };
      69             :   //Rowmap will return the indices to match along the 5th axis of convFunc, polmap is for the 3rd axis, and chanmap is for the 4th axis.
      70             :   //Rowmap will map combination of pa, antennapair and w to give the 5th index that matches 
      71             :   //Rowmap will be the same nrow as vb.nrows , polmap will gave the same length of vb.ncorrelations and chanmap will be the length of vb.nchannelscasacore::Vector<casacore::Int>& rowMap
      72             : 
      73             :   void getConvIndices(casacore::Vector<casacore::Int> &polMap,
      74             :                       casacore::Vector<casacore::Int> &chanMap,
      75             :                       casacore::Vector<casacore::Int> &rowMap,
      76             :                       const vi::VisBuffer2 &vb,
      77             :                       const casacore::Matrix<casacore::Double> &rotuvw,
      78             :                       const casacore::Vector<casacore::Double> &freqs,
      79             :                       const casacore::Bool predictMode=false,
      80             :                       const bool ispsf=false);
      81             : 
      82             : 
      83             :   
      84             :   //This version is for HPG gridder only;  which uses subsets of the convfuncs
      85             :   void getConvIndicesHPG( casacore::Vector<casacore::Int>& polMap, casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Int>& rowMap, const vi::VisBuffer2& vb, const casacore::Matrix<casacore::Double>& rotuvw);
      86             :   //Function gives pointing direction w.r.t image center  in phase shift: used in putting a phase gradient in the UV domain
      87             :   // Will be using for now only 1st row.
      88             :   Vector<Double> getPointingPhaseShift(const vi::VisBuffer2& vb, const bool usepointing=False);
      89             : 
      90             :  
      91             :   // This function will return a subset of the convFuncs, i.e those used in this
      92             :   // vb 
      93             :   void getConvFuncs(casacore::Vector<casacore::Int> &polMap,
      94             :                     casacore::Vector<casacore::Int> &chanMap,
      95             :                     casacore::Vector<casacore::Int> &rowMap,
      96             :                     casacore::Array<casacore::Complex>& convFunc,
      97             :                     casacore::Array<casacore::Complex>& wgtConvFunc,
      98             :                     const vi::VisBuffer2 &vb,
      99             :                     const casacore::Matrix<casacore::Double> &rotuvw,
     100             :                     const casacore::Vector<casacore::Double>& interpFreqs,
     101             :                     const casacore::Bool predictMode=false,
     102             :                     const bool ispsf=false);
     103             : 
     104             :   //help AWConvFunc decide if single field or not
     105           0 :   void setSingleField(const bool isSingleField = False){
     106           0 :     isSingleField_p = isSingleField;
     107           0 :   };
     108             : 
     109             : private:
     110             :   void appendConvFuncs(const casacore::Array<casacore::Complex> &awConv,
     111             :                        const casacore::Array<casacore::Complex> &aWwtConv,
     112             :                        const casacore::Matrix<casacore::Int> &awsupport,
     113             :                        const casacore::Vector<casacore::Double> &newfreqs,
     114             :                        const casacore::Double paval,
     115             :                        const int startrow=0);
     116             : 
     117             :   double painc_p;
     118             :   bool dosquint_p;
     119             :   casacore::Array<casacore::Complex> convFunc_p;
     120             :   casacore::Array<casacore::Complex> wgtConvFunc_p;
     121             :   casacore::Vector<Stokes::StokesTypes> polVals_p;
     122             :   casacore::Vector<Double> freqVals_p;
     123             :   casacore::Vector<Double> wVals_p;
     124             :   casacore::Vector<Double> paVals_p;
     125             :   casacore::Vector<std::pair<int, int> > antpairVals_p;
     126             :   /// The following are for HPG gridder which is a subset of convfuncs per spw
     127             :   casacore::Array<casacore::Complex> convFuncHPG_p;
     128             :   casacore::Array<casacore::Complex> wgtConvFuncHPG_p;
     129             :   casacore::Vector<Double> freqValsHPG_p;
     130             :   casacore::Vector<Double> wValsHPG_p;
     131             :   ///These 3 vectors will be the same length as the 5th axis pf convFunc
     132             :   // they will point to the index of wvals or paval or antpair vetcor value for which the convfunc is
     133             :   casacore::Vector<Int> rowAxisWVals_p;
     134             :   casacore::Vector<Int> rowAxisPAVals_p;
     135             :   casacore::Vector<Int > rowAxisAntennaPair_p;
     136             :   casacore::Vector<Int> convSizes_p;
     137             :   casacore::Vector<Int> convSupport_p;
     138             :   // HPG versions
     139             :   casacore::Vector<Int> convSizesHPG_p;
     140             :   casacore::Vector<Int> convSupportHPG_p;
     141             :   //Image parameters that the convfunc will map to (for now the direction
     142             :   //increment is what matters for the csys_p
     143             :   casacore::CoordinateSystem outcsys_p;
     144             :   casacore::CoordinateSystem calcCsys_p;
     145             :   int nx_p;
     146             :   int ny_p;
     147             :   int calcNpix_p;
     148             :   int oversamp_p;
     149             :   std::shared_ptr<EVLAAperture> aterm_p;
     150             :   std::shared_ptr<VisBufferUtil> vbutil_p;
     151             :   bool isSingleField_p;
     152             : };
     153             :   
     154             :    }//# end namespace refim
     155             : } // end namespace casa
     156             : 
     157             : 
     158             : #endif
     159             : 
     160             : 
     161             : 
     162             : 
     163             : 
     164             : 
     165             : 
     166             : 

Generated by: LCOV version 1.16