LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - FTMachine.h (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 32 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 28 0.0 %

          Line data    Source code
       1             : //# FTMachine.h: Definition for FTMachine
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
       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             : 
      29             : #ifndef SYNTHESIS_TRANSFORM2_FTMACHINE_H
      30             : #define SYNTHESIS_TRANSFORM2_FTMACHINE_H
      31             : 
      32             : #include <casacore/measures/Measures/Measure.h>
      33             : #include <casacore/measures/Measures/MDirection.h>
      34             : #include <casacore/measures/Measures/MPosition.h>
      35             : #include <casacore/measures/Measures/MeasTable.h>
      36             : #include <casacore/casa/Arrays/Array.h>
      37             : #include <casacore/casa/Arrays/Vector.h>
      38             : #include <casacore/casa/Arrays/Matrix.h>
      39             : #include <casacore/casa/Logging/LogIO.h>
      40             : #include <casacore/casa/Logging/LogSink.h>
      41             : #include <casacore/casa/Logging/LogMessage.h>
      42             : #include <casacore/casa/Containers/RecordInterface.h>
      43             : #include <casacore/casa/Containers/Block.h>
      44             : #include <casacore/images/Images/TempImage.h>
      45             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      46             : #include <casacore/scimath/Mathematics/InterpolateArray1D.h>
      47             : #include <synthesis/TransformMachines2/CFCache.h>
      48             : #include <synthesis/TransformMachines2/CFStore2.h>
      49             : #include <synthesis/TransformMachines2/ConvolutionFunction.h>
      50             : #include <synthesis/TransformMachines2/PolOuterProduct.h>
      51             : #include <msvis/MSVis/VisBufferUtil.h>
      52             : #include <casacore/images/Images/ImageInterface.h>
      53             : #include <casacore/images/Images/SubImage.h>
      54             : #include <synthesis/TransformMachines/StokesImageUtil.h>
      55             : #include <synthesis/Utilities/FFT2D.h>
      56             : #include <synthesis/ImagerObjects/SIImageStore.h>
      57             : #include <synthesis/ImagerObjects/SIImageStoreMultiTerm.h>
      58             : 
      59             : #include <synthesis/TransformMachines2/SkyJones.h>
      60             : #include <iomanip>
      61             : namespace casacore{
      62             : 
      63             :   class UVWMachine;
      64             : }
      65             : 
      66             : namespace casa{ //# namespace casa
      67             : 
      68             :   class VisModelData;
      69             :   namespace vi{ class VisBuffer2;
      70             :                   class VisibilityIterator2;
      71             :   }
      72             :  namespace refim{ //#    namespace for refactored imaging code with vi2/vb2
      73             :   class BriggsCubeWeightor;
      74             :   class SkyJones;
      75             : // <summary> defines interface for the Fourier Transform Machine </summary>
      76             : 
      77             : // <use visibility=export>
      78             : 
      79             : // <reviewed reviewer="" date="" tests="" demos="">
      80             : 
      81             : // <prerequisite>
      82             : //   <li> <linkto class=SkyModel>SkyModel</linkto> module
      83             : //   <li> <linkto class=SkyEquation>SkyEquation</linkto> module
      84             : //   <li> <linkto class=VisBuffer>VisBuffer</linkto> module
      85             : // </prerequisite>
      86             : //
      87             : // <etymology>
      88             : // FTMachine is a Machine for Fourier Transforms
      89             : // </etymology>
      90             : //
      91             : // <synopsis> 
      92             : // The <linkto class=SkyEquation>SkyEquation</linkto> needs to be able
      93             : // to perform Fourier transforms on visibility data. FTMachine
      94             : // allows efficient Fourier Transform processing using a 
      95             : // <linkto class=VisBuffer>VisBuffer</linkto> which encapsulates
      96             : // a chunk of visibility (typically all baselines for one time)
      97             : // together with all the information needed for processing
      98             : // (e.g. UVW coordinates).
      99             : // </synopsis> 
     100             : //
     101             : // <example>
     102             : // A simple example of a FTMachine is found in 
     103             : // <linkto class=GridFT>GridFT</linkto>.
     104             : // See the example for <linkto class=SkyModel>SkyModel</linkto>.
     105             : // </example>
     106             : //
     107             : // <motivation>
     108             : // Define an interface to allow efficient processing of chunks of 
     109             : // visibility data
     110             : //
     111             : // Note that the image must be Complex. It must contain the
     112             : // casacore::Complex casacore::Stokes values (e.g. RR,RL,LR,LL). FTMachine
     113             : // uses the image coordinate system to determine mappings
     114             : // between the polarization and frequency values in the
     115             : // casacore::PagedImage and in the VisBuffer.
     116             : //
     117             : // </motivation>
     118             : //
     119             : // <todo asof="97/10/01">
     120             : // </todo>
     121             : 
     122             : class FTMachine {
     123             : public:
     124             : 
     125             :   //# Enumerations
     126             :   // Types of known Images that may be made using the makeImage method 
     127             :   enum Type {
     128             :     OBSERVED=0,         // From OBSERVED visibility data (default)
     129             :     MODEL,              // From MODEL visibility data
     130             :     CORRECTED,          // From CORRECTED visibility data
     131             :     RESIDUAL,           // From RESIDUAL (OBSERVED-MODEL) visibility data
     132             :     PSF,                // POINT SPREAD FUNCTION
     133             :     COVERAGE,           // COVERAGE (SD only)
     134             :     WEIGHT,             // For gridding weights
     135             :     N_types,            // Number of types
     136             :     DEFAULT=OBSERVED
     137             :   };
     138             : 
     139             :   FTMachine();
     140             : 
     141             : 
     142             :   FTMachine(casacore::CountedPtr<CFCache>& cfcache,casacore::CountedPtr<ConvolutionFunction>& cfctor);
     143             : 
     144             :   FTMachine(const FTMachine& other);
     145             : 
     146             :   FTMachine& operator=(const FTMachine& other);
     147             : 
     148           0 :   void setBasePrivates(const FTMachine& other){FTMachine::operator=(other);}
     149             : 
     150             :   virtual ~FTMachine();
     151             :   
     152             : 
     153             :   //clone copy
     154             :   //should make it pure virtual forcing every ftm to have a cloner
     155             :   virtual FTMachine* cloneFTM();
     156             :   // Initialize transform to Visibility plane
     157             :   virtual void initializeToVis(casacore::ImageInterface<casacore::Complex>& image, const vi::VisBuffer2& vb) = 0;
     158             : 
     159             :   virtual void initializeToVisNew(const vi::VisBuffer2& vb,
     160             :                                              casacore::CountedPtr<SIImageStore> imstore);
     161             : 
     162             :   //-------------------------------------------------------------------------------------
     163             :   // Finalize transform to Visibility plane
     164             :   // This is mostly a no-op, and is not-even called from CubeSkyEquation.
     165             :   virtual void finalizeToVis() = 0;
     166             : 
     167             :   // Note : No vectorized form of finalizeToVis yet.....
     168             : 
     169             :   //-------------------------------------------------------------------------------------
     170             :   // Initialize transform to Sky plane
     171             :   
     172             :   virtual void initializeToSky(casacore::ImageInterface<casacore::Complex>& image,
     173             :                                casacore::Matrix<casacore::Float>& weight, const vi::VisBuffer2& vb) = 0;
     174             :   
     175             : 
     176             :   virtual void initializeToSkyNew(const casacore::Bool dopsf, 
     177             :                                   const vi::VisBuffer2& vb, 
     178             :                                   casacore::CountedPtr<SIImageStore> imstore);
     179             : 
     180             :   //-------------------------------------------------------------------------------------
     181             :   //This function has to be called after initMaps to initialize Briggs
     182             :   //Cube weighting scheme
     183             :   virtual void initBriggsWeightor(vi::VisibilityIterator2& vi);
     184             : 
     185             :   
     186             :   // Finalize transform to Sky plane
     187             :   virtual void finalizeToSky() = 0;
     188             : 
     189           0 :   virtual void finalizeToSky(casacore::ImageInterface<casacore::Complex>& iimage){(void)iimage;};
     190             : 
     191             :  
     192             :   virtual void finalizeToSkyNew(casacore::Bool dopsf, 
     193             :                                 const vi::VisBuffer2& vb,
     194             :                                            casacore::CountedPtr<SIImageStore> imstore  );
     195             :   //Do the finalization for A projection weight images
     196             :   virtual void finalizeToWeightImage(const vi::VisBuffer2& vb,
     197             :                                            casacore::CountedPtr<SIImageStore> imstore  );
     198             : 
     199             :   
     200             :   //-------------------------------------------------------------------------------------
     201             : 
     202             :   // Get actual coherence from grid
     203             :   virtual void get(vi::VisBuffer2& vb, casacore::Int row=-1) = 0;
     204             : 
     205             :   // Put coherence to grid
     206             :   virtual void put(const vi::VisBuffer2& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
     207             :                    refim::FTMachine::Type type= refim::FTMachine::OBSERVED)=0;
     208             :   
     209             :   // Non const vb version - so that weights can be modified in-place
     210             :   // Currently, used only by MultiTermFT
     211           0 :   virtual void put(vi::VisBuffer2& vb, casacore::Int row=-1, casacore::Bool dopsf=false, 
     212             :                    refim::FTMachine::Type type= refim::FTMachine::OBSERVED)
     213           0 :   {put((const vi::VisBuffer2&)vb,row,dopsf,type);};
     214             : 
     215             :   // This is needed for A-term FTMachines. Others it is effectively a NOP
     216             :   // Or sumweights on all pixels
     217           0 :   virtual void gridImgWeights(const vi::VisBuffer2& /*vb*/) { return;   };
     218             :   
     219             :   //-------------------------------------------------------------------------------------
     220             :   virtual void correlationToStokes(casacore::ImageInterface<casacore::Complex>& compImage, 
     221             :                                    casacore::ImageInterface<casacore::Float>& resImage, 
     222             :                                    const casacore::Bool dopsf);
     223             :  
     224             :   virtual void stokesToCorrelation(casacore::ImageInterface<casacore::Float>& modelImage,
     225             :                                    casacore::ImageInterface<casacore::Complex>& compImage);
     226             : 
     227             :   /*
     228             :   virtual void normalizeSumWeight(casacore::ImageInterface<casacore::Float>& inOutImage, 
     229             :                                casacore::ImageInterface<casacore::Float>& weightImage, 
     230             :                                const casacore::Bool dopsf);
     231             :   */
     232             : 
     233           0 :   virtual void normalizeImage(casacore::Lattice<casacore::Complex>&,//skyImage,
     234             :                               const casacore::Matrix<casacore::Double>&,// sumOfWts,
     235             :                               casacore::Lattice<casacore::Float>&,// sensitivityImage,
     236           0 :                               casacore::Bool /*fftNorm*/){return;};
     237             : 
     238             :   virtual void normalizeImage(casacore::ImageInterface<casacore::Float>& skyImage,
     239             :                               casacore::Matrix<casacore::Float>& sumOfWts,
     240             :                               casacore::ImageInterface<casacore::Float>& sensitivityImage,
     241             :                               casacore::Bool dopsf, casacore::Float pblimit, casacore::Int normtype);
     242             : 
     243             : 
     244             :   // All FTMachines that fill weightimage, need to set this.
     245             :   // TODO : Make this pure virtual.
     246           0 :   virtual casacore::Bool useWeightImage(){return false;}; 
     247           0 :   virtual casacore::Bool isSkyJonesSet(){return (sj_p.nelements()>0) && !( sj_p[0]).null()  ;}
     248           0 :   virtual casacore::Bool isSkyJonesChanged(vi::VisBuffer2& vb, casacore::Int row){if(sj_p.nelements()>0){return sj_p[0]->changed(vb,row);} else {return false;} };
     249             : 
     250             :   // Set SkyJones if image domain corrections /applycation are needed
     251             :   // To reset the the FTMachine for stopping image based correction/applycation
     252             :   // set in a casacore::Vector of size 0.
     253             :   // The pointers have to be handled by the caller ..no delete happening here
     254             :   virtual void setSkyJones(casacore::Vector<casacore::CountedPtr<SkyJones> >& sj);
     255             :   
     256             :   casacore::Bool changedSkyJonesLogic(const vi::VisBuffer2& vb, casacore::Bool& firstRow, casacore::Bool& internalRow);
     257             : 
     258             : 
     259             :   //-------------------------------------------------------------------------------------
     260             : 
     261             :   // Get the gridded visibilities or weight
     262             :   template <typename T> void getGrid(casacore::Array<T>& thegrid);
     263             :   // get pointers to storage for gridded visibilities or weight; size
     264             :   // to number of elements in storage; may not be implemented by all
     265             :   // sub-classes, if not, will return empty shared_ptr and size equal
     266             :   // to 0
     267             :   virtual std::shared_ptr<std::complex<double>> getGridPtr(size_t& size) const;
     268             :   virtual std::shared_ptr<double> getSumWeightsPtr(size_t& size) const;
     269             : 
     270             :   // Get the final image
     271             :   virtual casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>&, casacore::Bool normalize=true) = 0;
     272           0 :   virtual const casacore::CountedPtr<refim::ConvolutionFunction>& getAWConvFunc() {return convFuncCtor_p;};
     273             : 
     274           0 :   virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>&,// image,
     275           0 :                                 const vi::VisBuffer2& /*vb*/) {};
     276             :   // Get the final weights image
     277             :   virtual void getWeightImage(casacore::ImageInterface<casacore::Float>& weightImage, casacore::Matrix<casacore::Float>& weights) = 0;
     278             : 
     279             : 
     280             :   //Put the weights image so that it is not calculated again
     281             :   // Useful for A-projection style gridders
     282             : 
     283           0 :   virtual void setWeightImage(casacore::ImageInterface<casacore::Float>& /*weightImage*/){ /*do nothing for gridders that don't use this in degridding*/ };
     284             :   // Get a flux (divide by this to get a flux density correct image) 
     285             :   // image if there is one
     286           0 :   virtual void getFluxImage(casacore::ImageInterface<casacore::Float>& image){(void)image;};
     287             : 
     288             :   // Make the entire image
     289             :   // Make the entire image using a ROVisIter
     290             :   virtual void makeImage(FTMachine::Type type,
     291             :                          vi::VisibilityIterator2& vi,
     292             :                          casacore::ImageInterface<casacore::Complex>& image,
     293             :                          casacore::Matrix<casacore::Float>& weight);
     294             : 
     295             :   //-------------------------------------------------------------------------------------
     296             : 
     297             :   // Rotate the uvw from the observed phase center to the
     298             :   // desired phase center.
     299             :   void rotateUVW(casacore::Matrix<casacore::Double>& uvw, casacore::Vector<casacore::Double>& dphase,
     300             :                  const vi::VisBuffer2& vb);
     301             : 
     302             :   //rotate with facetting style rephasing..for multifield mosaic
     303             :   void girarUVW(casacore::Matrix<casacore::Double>& uvw, casacore::Vector<casacore::Double>& dphase,
     304             :                 const vi::VisBuffer2& vb);
     305             : 
     306             :   // Refocus on a finite distance
     307             :   void refocus(casacore::Matrix<casacore::Double>& uvw, const casacore::Vector<casacore::Int>& ant1,
     308             :                const casacore::Vector<casacore::Int>& ant2,
     309             :                casacore::Vector<casacore::Double>& dphase, const vi::VisBuffer2& vb);
     310             :   //helper function for openmp to call ...no private dependency
     311             :   static void locateuvw(const casacore::Double*& uvw, const casacore::Double*&dphase, const casacore::Double*& freq, const casacore::Int& nchan, const casacore::Double*& scale, const casacore::Double*& offset,  const casacore::Int& sampling, casacore::Int*& loc,casacore::Int*& off, casacore::Complex*& phasor, const casacore::Int& row, const casacore::Bool& doW=false); 
     312             :                  
     313             : 
     314             :   // Save and restore the FTMachine to and from a record
     315             :   virtual casacore::Bool toRecord(casacore::String& error, casacore::RecordInterface& outRecord, 
     316             :                         casacore::Bool withImage=false, const casacore::String diskimagename="");
     317             :   virtual casacore::Bool fromRecord(casacore::String& error, const casacore::RecordInterface& inRecord);
     318             : 
     319             :   // Has this operator changed since the last application?
     320             :   virtual casacore::Bool changed(const vi::VisBuffer2& vb);
     321             :   // Can this FTMachine be represented by Fourier convolutions?
     322           0 :   virtual casacore::Bool isFourier() {return false;}
     323             : 
     324             :   //set  otf spectral frame transform is on or off;
     325             :   casacore::Bool setFrameValidity(casacore::Bool validFrame);
     326             : 
     327             :   //return whether the ftmachine is using a double precision grid
     328             :   virtual casacore::Bool doublePrecGrid();
     329             : 
     330             :   // To make sure no padding is used in certain gridders
     331           0 :   virtual void setNoPadding(casacore::Bool nopad){(void)nopad;};
     332             :   
     333             :   // Return the name of the machine
     334             : 
     335             :   virtual casacore::String name() const =0;// { return "None";};
     336             :  
     337             :   // set and get the location used for frame 
     338             :   virtual void setLocation(const casacore::MPosition& loc);
     339             :   virtual casacore::MPosition& getLocation();
     340             : 
     341             :   // set a moving source aka planets or comets =>  adjust phase center
     342             :   // on the fly for gridding 
     343             :   virtual void setMovingSource(const casacore::String& sourcename, const casacore::String& ephemtable="");
     344             :   virtual void setMovingSource(const casacore::MDirection& mdir);
     345             : 
     346             :   //reset stuff in an FTMachine
     347             :   virtual void reset();
     348             : 
     349             :   //set frequency interpolation type
     350             :   virtual void setFreqInterpolation(const casacore::String& method);
     351             :   virtual void setFreqInterpolation(const casacore::InterpolateArray1D<casacore::Double,casacore::Complex>::InterpolationMethod type);
     352             :   //tell ftmachine which Pointing table column to use for Direction
     353             :   //Mosaic or Single dish ft use this for example
     354             :   virtual void setPointingDirColumn(const casacore::String& column="DIRECTION");
     355             : 
     356             :   virtual casacore::String getPointingDirColumnInUse();
     357             : 
     358             :   virtual void setSpwChanSelection(const casacore::Cube<casacore::Int>& spwchansels);
     359             :   virtual void setSpwFreqSelection(const casacore::Matrix<casacore::Double>& spwfreqs);
     360             : 
     361             :   // set the order of the Taylor term for MFS this is to tell
     362             :   // A-casacore::Projection to qualify the accumulated avgPB for each Taylor
     363             :   // term in the CFCache.
     364             :   virtual void setMiscInfo(const casacore::Int qualifier)=0;
     365             : 
     366           0 :   virtual void setCanComputeResiduals(casacore::Bool& b) {canComputeResiduals_p=b;};
     367           0 :   virtual casacore::Bool canComputeResiduals() {return canComputeResiduals_p;};
     368             :   //
     369             :   // Make the VB and VBStore interefaces for the interim re-factoring
     370             :   // work.  Finally removed the VB interface.
     371             :   virtual void ComputeResiduals(vi::VisBuffer2&vb, casacore::Bool useCorrected) = 0;
     372           0 :   virtual casacore::Float getPBLimit() {return pbLimit_p;};
     373             :   //virtual void ComputeResiduals(VBStore& vb)=0;
     374             :   //get and set numthreads
     375             :   void setnumthreads(casacore::Int n);
     376             :   casacore::Int getnumthreads();
     377             : 
     378             :   virtual void setCFCache(casacore::CountedPtr<CFCache>& cfc, const casacore::Bool resetCFC=true);
     379           0 :   casacore::CountedPtr<CFCache> getCFCache() {return cfCache_p;};
     380             :   casacore::String getCacheDir() { return cfCache_p->getCacheDir(); };
     381             : 
     382           0 :   virtual void setDryRun(casacore::Bool val) {isDryRun=val;};
     383           0 :   virtual casacore::Bool dryRun() {return isDryRun;}
     384           0 :   virtual casacore::Bool isUsingCFCache() {return (cfCache_p.nrefs()!=0);}
     385             : 
     386           0 :   virtual const casacore::CountedPtr<refim::FTMachine>& getFTM2(const casacore::Bool ) 
     387           0 :   {throw(casacore::AipsError("FTMachine::getFTM2() called directly!"));}
     388             : 
     389             :   casacore::Bool isDryRun;
     390           0 :   void setPseudoIStokes(casacore::Bool pseudoI){isPseudoI_p=pseudoI;};
     391             : 
     392             :    //set and get Time to calculate phasecenter  -1.0 means using the time available at 
     393             :   //each iteration..this is used when the phasecenter in the field table is either 
     394             :   //a polynomial or has a ephemerides tables associated with it
     395             :   //Using double in the units and epoch-frame of the ms(s) ..caller is responsible for conversion
     396             :   void setPhaseCenterTime(const casacore::Double time){phaseCenterTime_p=time;};
     397             :   casacore::Double getPhaseCenterTime(){return phaseCenterTime_p;};
     398             :   casacore::Vector<casacore::Int> channelMap(const vi::VisBuffer2& vb);
     399           0 :   casacore::Matrix<casacore::Double> getSumWeights(){return  sumWeight;};
     400             : 
     401             :   ///Functions associated with Briggs weighting for cubes
     402           0 :   void setBriggsCubeWeight(casacore::CountedPtr<refim::BriggsCubeWeightor> bwght){briggsWeightor_p=bwght;};
     403             :   void getImagingWeight(casacore::Matrix<casacore::Float>& imwght, const vi::VisBuffer2& vb);
     404             :   ///utility function that returns a rough estimate of memory needed.
     405             :   virtual casacore::Long estimateRAM(const casacore::CountedPtr<SIImageStore>& imstore);
     406             :   ///call this to clear temporary file
     407             :   // for e.g imaging weight column associated with this ftmachine
     408             :   virtual casacore::Vector<casacore::String> cleanupTempFiles(const casacore::String& message);
     409             : 
     410           0 :   virtual void setFTMType(const FTMachine::Type& type) {ftmType_p=type;};
     411           0 :   virtual void setPBReady(const bool& isready) {avgPBReady_p=isready;};
     412             : protected:
     413             : 
     414             :   friend class VisModelData;
     415             :   friend class MultiTermFT;
     416             :   friend class MultiTermFTNew;
     417             :   friend class BriggsCubeWeightor;
     418             :   casacore::LogIO logIO_p;
     419             : 
     420             :   casacore::LogIO& logIO();
     421             : 
     422             :   casacore::ImageInterface<casacore::Complex>* image;
     423             : 
     424             :   casacore::UVWMachine* uvwMachine_p;
     425             :   casacore::CountedPtr<casacore::UVWMachine> phaseShifter_p;
     426             : 
     427             :   casacore::MeasFrame mFrame_p;
     428             : 
     429             :   // Direction of desired tangent plane
     430             :   casacore::Bool tangentSpecified_p;
     431             :   casacore::MDirection mTangent_p;
     432             : 
     433             :   casacore::MDirection mImage_p;
     434             : 
     435             :   // moving source stuff
     436             :   casacore::MDirection movingDir_p;
     437             :   casacore::Bool fixMovingSource_p;
     438             :   casacore::String ephemTableName_p;
     439             :   casacore::MDirection firstMovingDir_p;
     440             :   // This will hold the angular difference between movingDir and firstMovingDir with 
     441             :   // the frame conversion done properly etc..
     442             :   casacore::MVDirection movingDirShift_p;
     443             : 
     444             :   casacore::Double distance_p;
     445             : 
     446             :   casacore::uInt nAntenna_p;
     447             : 
     448             :   casacore::Int lastFieldId_p;
     449             :   casacore::Int lastMSId_p;
     450             :   casacore::CountedPtr<casacore::MSColumns> romscol_p;
     451             :   //Use douple precision grid in gridding process
     452             :   casacore::Bool useDoubleGrid_p;
     453             : 
     454             :   virtual void initMaps(const vi::VisBuffer2& vb);
     455             :   
     456             :   virtual void initPolInfo(const vi::VisBuffer2& vb);
     457             : 
     458             :   // Sum of weights per polarization and per chan
     459             :   casacore::Matrix<casacore::Double> sumWeight, sumCFWeight;
     460             : 
     461             :   // Sizes
     462             :   casacore::Int nx, ny, npol, nchan, nvischan, nvispol;
     463             : 
     464             :   // Maps of channels and polarization
     465             :   casacore::Vector<casacore::Int> chanMap, polMap;
     466             : 
     467             :   // Stokes pseudo I only? single parallel flagged will be allowed.
     468             :   casacore::Bool isPseudoI_p;
     469             : 
     470             :   // Default Position used for phase rotations
     471             :   casacore::MPosition mLocation_p;
     472             : 
     473             :   // Set if uvwrotation is necessary
     474             : 
     475             :   casacore::Bool doUVWRotation_p;
     476             :   virtual void ok();
     477             : 
     478             :   // check if image is big enough for gridding
     479             :   
     480             :   virtual void gridOk (casacore::Int gridsupport);
     481             : 
     482             :   
     483             :   // setup multiple spectral window for cubes
     484             :   //casacore::Block <casacore::Vector <casacore::Int> > multiChanMap_p;
     485             :   //casacore::Vector<casacore::Int> selectedSpw_p;
     486             :   casacore::Vector<casacore::Int> nVisChan_p;
     487             :   casacore::Bool matchChannel(const casacore::Int& spw, 
     488             :                     const VisBuffer& vb);
     489             :   casacore::Bool matchChannel(const vi::VisBuffer2& vb);
     490             :   casacore::Bool matchPol(const vi::VisBuffer2& vb);
     491             :   //redo all spw chan match especially if ms has changed underneath 
     492             :   casacore::Bool matchAllSpwChans(const VisBuffer& vb);
     493             :   //casacore::Bool matchAllSpwChans(const vi::VisBuffer2& vb);
     494             :   //interpolate visibility data of vb to grid frequency definition
     495             :   //flag will be set the one as described in interpolateArray1D
     496             :   //return false if no interpolation is done...for e.g for nearest case
     497             : 
     498             :   virtual casacore::Bool interpolateFrequencyTogrid(const vi::VisBuffer2& vb,
     499             :                                           const casacore::Matrix<casacore::Float>& wt,
     500             :                                           casacore::Cube<casacore::Complex>& data,
     501             :                                           casacore::Cube<casacore::Int>& flag,
     502             :                                           casacore::Matrix<casacore::Float>& weight,
     503             :                                           FTMachine::Type type=FTMachine::OBSERVED );
     504             :   //degridded data interpolated back onto visibilities
     505             : 
     506             :   virtual casacore::Bool interpolateFrequencyFromgrid(vi::VisBuffer2& vb,
     507             :                                             casacore::Cube<casacore::Complex>& data,
     508             :                                             FTMachine::Type type=FTMachine::MODEL );
     509             : 
     510             :   //Interpolate visibilities to be degridded upon
     511             : 
     512             :   virtual void getInterpolateArrays(const vi::VisBuffer2& vb,
     513             :                                     casacore::Cube<casacore::Complex>& data, casacore::Cube<casacore::Int>& flag);
     514             : 
     515             : 
     516             :   void setSpectralFlag(const vi::VisBuffer2& vb, casacore::Cube<casacore::Bool>& modflagcube);
     517             :   //Save/Recover some elements of state of ftmachine in/from record
     518             :   casacore::Bool storeMovingSourceState(casacore::String& error, casacore::RecordInterface& outRecord);
     519             :   //helper to save Measures in a record
     520             :   casacore::Bool saveMeasure(casacore::RecordInterface& rec, const casacore::String& name, casacore::String& error, const casacore::Measure& ms);
     521             :   casacore::Bool recoverMovingSourceState(casacore::String& error, const casacore::RecordInterface& inRecord);
     522             :   casacore::Matrix<casacore::Double> negateUV(const vi::VisBuffer2& vb);
     523             : 
     524             :   // Private variables needed for spectral frame conversion 
     525             :   casacore::SpectralCoordinate spectralCoord_p;
     526             :   casacore::Vector<casacore::Stokes::StokesTypes> visPolMap_p;
     527             :   //casacore::Vector<casacore::Bool> doConversion_p;
     528             :   casacore::Bool freqFrameValid_p;
     529             :   casacore::Vector<casacore::Double> imageFreq_p;
     530             :   //casacore::Vector of float lsrfreq needed for regridding
     531             :   casacore::Vector<casacore::Double> lsrFreq_p;
     532             :   casacore::Vector<casacore::Double> interpVisFreq_p;
     533             :   casacore::InterpolateArray1D<casacore::Double,casacore::Complex>::InterpolationMethod freqInterpMethod_p;
     534             :   casacore::String pointingDirCol_p;
     535             :   casacore::Cube<casacore::Int> spwChanSelFlag_p;
     536             :   casacore::Matrix<casacore::Double> spwFreqSel_p, expandedSpwFreqSel_p,expandedSpwConjFreqSel_p;
     537             :   casacore::Vector<casacore::Int> cfStokes_p;
     538             :   casacore::Int polInUse_p;
     539             :   casacore::CountedPtr<CFCache> cfCache_p;
     540             :   CFStore cfs_p, cfwts_p;
     541             :   casacore::CountedPtr<CFStore2> cfs2_p, cfwts2_p;
     542             : 
     543             :   casacore::CountedPtr<ConvolutionFunction> convFuncCtor_p;
     544             :   casacore::CountedPtr<PolOuterProduct> pop_p;
     545             : 
     546             :   casacore::Bool canComputeResiduals_p;
     547             :   casacore::Bool toVis_p;
     548             :   casacore::Int numthreads_p;
     549             :   
     550             :   // casacore::Array for non-tiled gridding
     551             :   // These are common to most FTmachines
     552             :   casacore::Array<casacore::Complex> griddedData;
     553             :   casacore::Array<casacore::DComplex> griddedData2;
     554             : 
     555             : 
     556             :   casacore::Float pbLimit_p;
     557             :   //  casacore::Vector<SkyJones *> sj_p;
     558             :   casacore::Vector<casacore::CountedPtr<SkyJones> > sj_p;
     559             :   //A holder for the complex image if nobody else is keeping it
     560             :   casacore::CountedPtr<casacore::ImageInterface<casacore::Complex> > cmplxImage_p;
     561             :   casacore::CountedPtr<VisBufferUtil> vbutil_p;
     562             :   casacore::Double phaseCenterTime_p;
     563             :   ///Some parameters and helpers for multithreaded gridders
     564             :   casacore::Int doneThreadPartition_p;
     565             :   casacore::Vector<casacore::Int> xsect_p, ysect_p, nxsect_p, nysect_p;
     566             :   casacore::CountedPtr<refim::BriggsCubeWeightor> briggsWeightor_p;
     567             :   virtual void   findGridSector(const casacore::Int& nxp, const casacore::Int& nyp, const casacore::Int& ixsub, const casacore::Int& iysub, const casacore::Int& minx, const casacore::Int& miny, const casacore::Int& icounter, casacore::Int& x0, casacore::Int& y0, casacore::Int& nxsub, casacore::Int& nysub, const casacore::Bool linear); 
     568             :   
     569             :   virtual void tweakGridSector(const casacore::Int& nx, const casacore::Int& ny, 
     570             :                                const casacore::Int& ixsub, const casacore::Int& iysub);
     571             :   void initSourceFreqConv();
     572             :   void shiftFreqToSource(casacore::Vector<casacore::Double>& freqs);
     573             :   ///moving source spectral frame stuff
     574             :   casacore::MRadialVelocity::Convert obsvelconv_p;
     575             :   casacore::MeasTable::Types mtype_p;
     576             :   FFT2D ft_p;
     577             :   casacore::Vector<casacore::String> tempFileNames_p;
     578             :   FTMachine::Type ftmType_p;
     579             :   casacore::Bool avgPBReady_p;
     580             : 
     581             : 
     582             :  private:
     583           0 :   virtual casacore::Bool isSD() const {return false;}
     584             : 
     585             :   //Some temporary wasteful function for swapping axes because we don't 
     586             :   //Interpolation along the second axis...will need to implement 
     587             :   //interpolation on y axis of a cube. 
     588             :   
     589             :   void swapyz(casacore::Cube<casacore::Complex>& out, const casacore::Cube<casacore::Complex>& in);
     590             :   void swapyz(casacore::Cube<casacore::Complex>& out, const casacore::Cube<casacore::Bool>& outFlag, const casacore::Cube<casacore::Complex>& in);
     591             :   void swapyz(casacore::Cube<casacore::Bool>& out, const casacore::Cube<casacore::Bool>& in);
     592             :   void convUVW(casacore::Double& dphase, casacore::Vector<casacore::Double>& thisrow);
     593             : };
     594             : 
     595             : #include <synthesis/TransformMachines/FTMachine.tcc>
     596             : 
     597             :   }//# end namespace refim
     598             : } // end namespace casa
     599             : #endif
     600             : 
     601             : 
     602             : 

Generated by: LCOV version 1.16