LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - FTMachine.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 2 34 5.9 %
Date: 2024-10-29 13:38:20 Functions: 1 29 3.4 %

          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: 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             : 
      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             :   // Provide derived classes with a mean to perform initialization tasks
     163             :   // each time the Visibility Iterator starts iterating over a new MeasurementSet
     164           0 :   virtual void handleNewMs(const casacore::MeasurementSet &ms,
     165           0 :                casacore::CountedPtr<SIImageStore> imstore) {}
     166             : 
     167             :   //-------------------------------------------------------------------------------------
     168             :   // Finalize transform to Visibility plane
     169             :   // This is mostly a no-op, and is not-even called from CubeSkyEquation.
     170             :   virtual void finalizeToVis() = 0;
     171             : 
     172             :   // Note : No vectorized form of finalizeToVis yet.....
     173             : 
     174             :   //-------------------------------------------------------------------------------------
     175             :   // Initialize transform to Sky plane
     176             : 
     177             :   virtual void initializeToSky(casacore::ImageInterface<casacore::Complex>& image,
     178             :                                casacore::Matrix<casacore::Float>& weight, const vi::VisBuffer2& vb) = 0;
     179             : 
     180             : 
     181             :   virtual void initializeToSkyNew(const casacore::Bool dopsf,
     182             :                                   const vi::VisBuffer2& vb,
     183             :                                   casacore::CountedPtr<SIImageStore> imstore);
     184             : 
     185             :   //-------------------------------------------------------------------------------------
     186             :   //This function has to be called after initMaps to initialize Briggs
     187             :   //Cube weighting scheme
     188             :   virtual void initBriggsWeightor(vi::VisibilityIterator2& vi);
     189             : 
     190             : 
     191             :   // Finalize transform to Sky plane
     192             :   virtual void finalizeToSky() = 0;
     193             : 
     194           0 :   virtual void finalizeToSky(casacore::ImageInterface<casacore::Complex>& iimage){(void)iimage;};
     195             : 
     196             : 
     197             :   virtual void finalizeToSkyNew(casacore::Bool dopsf,
     198             :                                 const vi::VisBuffer2& vb,
     199             :                                            casacore::CountedPtr<SIImageStore> imstore  );
     200             :   //Do the finalization for A projection weight images
     201             :   virtual void finalizeToWeightImage(const vi::VisBuffer2& vb,
     202             :                                            casacore::CountedPtr<SIImageStore> imstore  );
     203             : 
     204             : 
     205             :   //-------------------------------------------------------------------------------------
     206             : 
     207             :   // Get actual coherence from grid
     208             :   virtual void get(vi::VisBuffer2& vb, casacore::Int row=-1) = 0;
     209             : 
     210             :   // Put coherence to grid
     211             :   virtual void put(const vi::VisBuffer2& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
     212             :                    refim::FTMachine::Type type= refim::FTMachine::OBSERVED)=0;
     213             : 
     214             :   // Non const vb version - so that weights can be modified in-place
     215             :   // Currently, used only by MultiTermFT
     216         600 :   virtual void put(vi::VisBuffer2& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
     217             :                    refim::FTMachine::Type type= refim::FTMachine::OBSERVED)
     218         600 :   {put((const vi::VisBuffer2&)vb,row,dopsf,type);};
     219             : 
     220             :   // This is needed for A-term FTMachines. Others it is effectively a NOP
     221             :   // Or sumweights on all pixels
     222           0 :   virtual void gridImgWeights(const vi::VisBuffer2& /*vb*/) { return;   };
     223             : 
     224             :   //-------------------------------------------------------------------------------------
     225             :   virtual void correlationToStokes(casacore::ImageInterface<casacore::Complex>& compImage,
     226             :                                    casacore::ImageInterface<casacore::Float>& resImage,
     227             :                                    const casacore::Bool dopsf);
     228             : 
     229             :   virtual void stokesToCorrelation(casacore::ImageInterface<casacore::Float>& modelImage,
     230             :                                    casacore::ImageInterface<casacore::Complex>& compImage);
     231             : 
     232             :   /*
     233             :   virtual void normalizeSumWeight(casacore::ImageInterface<casacore::Float>& inOutImage,
     234             :                                casacore::ImageInterface<casacore::Float>& weightImage,
     235             :                                const casacore::Bool dopsf);
     236             :   */
     237             : 
     238           0 :   virtual void normalizeImage(casacore::Lattice<casacore::Complex>&,//skyImage,
     239             :                               const casacore::Matrix<casacore::Double>&,// sumOfWts,
     240             :                               casacore::Lattice<casacore::Float>&,// sensitivityImage,
     241           0 :                               casacore::Bool /*fftNorm*/){return;};
     242             : 
     243             :   virtual void normalizeImage(casacore::ImageInterface<casacore::Float>& skyImage,
     244             :                               casacore::Matrix<casacore::Float>& sumOfWts,
     245             :                               casacore::ImageInterface<casacore::Float>& sensitivityImage,
     246             :                               casacore::Bool dopsf, casacore::Float pblimit, casacore::Int normtype);
     247             : 
     248             : 
     249             :   // All FTMachines that fill weightimage, need to set this.
     250             :   // TODO : Make this pure virtual.
     251           0 :   virtual casacore::Bool useWeightImage(){return false;};
     252           0 :   virtual casacore::Bool isSkyJonesSet(){return (sj_p.nelements()>0) && !( sj_p[0]).null()  ;}
     253           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;} };
     254             : 
     255             :   // Set SkyJones if image domain corrections /applycation are needed
     256             :   // To reset the the FTMachine for stopping image based correction/applycation
     257             :   // set in a casacore::Vector of size 0.
     258             :   // The pointers have to be handled by the caller ..no delete happening here
     259             :   virtual void setSkyJones(casacore::Vector<casacore::CountedPtr<SkyJones> >& sj);
     260             : 
     261             :   casacore::Bool changedSkyJonesLogic(const vi::VisBuffer2& vb, casacore::Bool& firstRow, casacore::Bool& internalRow);
     262             : 
     263             : 
     264             :   //-------------------------------------------------------------------------------------
     265             : 
     266             :   // Get the gridded visibilities or weight
     267             :   template <typename T> void getGrid(casacore::Array<T>& thegrid);
     268             :   // get pointers to storage for gridded visibilities or weight; size
     269             :   // to number of elements in storage; may not be implemented by all
     270             :   // sub-classes, if not, will return empty shared_ptr and size equal
     271             :   // to 0
     272             :   virtual std::shared_ptr<std::complex<double>> getGridPtr(size_t& size) const;
     273             :   virtual std::shared_ptr<double> getSumWeightsPtr(size_t& size) const;
     274             : 
     275             :   // Get the final image
     276             :   virtual casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>&, casacore::Bool normalize=true) = 0;
     277           0 :   virtual const casacore::CountedPtr<refim::ConvolutionFunction>& getAWConvFunc() {return convFuncCtor_p;};
     278             : 
     279           0 :   virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>&,// image,
     280           0 :                                 const vi::VisBuffer2& /*vb*/) {};
     281             :   // Get the final weights image
     282             :   virtual void getWeightImage(casacore::ImageInterface<casacore::Float>& weightImage, casacore::Matrix<casacore::Float>& weights) = 0;
     283             : 
     284             : 
     285             :   //Put the weights image so that it is not calculated again
     286             :   // Useful for A-projection style gridders
     287             : 
     288           0 :   virtual void setWeightImage(casacore::ImageInterface<casacore::Float>& /*weightImage*/){ /*do nothing for gridders that don't use this in degridding*/ };
     289             :   // Get a flux (divide by this to get a flux density correct image)
     290             :   // image if there is one
     291           0 :   virtual void getFluxImage(casacore::ImageInterface<casacore::Float>& image){(void)image;};
     292             : 
     293             :   // Make the entire image
     294             :   // Make the entire image using a ROVisIter
     295             :   virtual void makeImage(FTMachine::Type type,
     296             :                          vi::VisibilityIterator2& vi,
     297             :                          casacore::ImageInterface<casacore::Complex>& image,
     298             :                          casacore::Matrix<casacore::Float>& weight);
     299             : 
     300             :   //-------------------------------------------------------------------------------------
     301             : 
     302             :   // Rotate the uvw from the observed phase center to the
     303             :   // desired phase center.
     304             :   void rotateUVW(casacore::Matrix<casacore::Double>& uvw, casacore::Vector<casacore::Double>& dphase,
     305             :                  const vi::VisBuffer2& vb);
     306             : 
     307             :   //rotate with facetting style rephasing..for multifield mosaic
     308             :   void girarUVW(casacore::Matrix<casacore::Double>& uvw, casacore::Vector<casacore::Double>& dphase,
     309             :                 const vi::VisBuffer2& vb);
     310             : 
     311             :   // Refocus on a finite distance
     312             :   void refocus(casacore::Matrix<casacore::Double>& uvw, const casacore::Vector<casacore::Int>& ant1,
     313             :                const casacore::Vector<casacore::Int>& ant2,
     314             :                casacore::Vector<casacore::Double>& dphase, const vi::VisBuffer2& vb);
     315             :   //helper function for openmp to call ...no private dependency
     316             :   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);
     317             : 
     318             : 
     319             :   // Save and restore the FTMachine to and from a record
     320             :   virtual casacore::Bool toRecord(casacore::String& error, casacore::RecordInterface& outRecord,
     321             :                         casacore::Bool withImage=false, const casacore::String diskimagename="");
     322             :   virtual casacore::Bool fromRecord(casacore::String& error, const casacore::RecordInterface& inRecord);
     323             : 
     324             :   // Has this operator changed since the last application?
     325             :   virtual casacore::Bool changed(const vi::VisBuffer2& vb);
     326             :   // Can this FTMachine be represented by Fourier convolutions?
     327           0 :   virtual casacore::Bool isFourier() {return false;}
     328             : 
     329             :   //set  otf spectral frame transform is on or off;
     330             :   casacore::Bool setFrameValidity(casacore::Bool validFrame);
     331             : 
     332             :   //return whether the ftmachine is using a double precision grid
     333             :   virtual casacore::Bool doublePrecGrid();
     334             : 
     335             :   // To make sure no padding is used in certain gridders
     336           0 :   virtual void setNoPadding(casacore::Bool nopad){(void)nopad;};
     337             : 
     338             :   // Return the name of the machine
     339             : 
     340             :   virtual casacore::String name() const =0;// { return "None";};
     341             : 
     342             :   // set and get the location used for frame
     343             :   virtual void setLocation(const casacore::MPosition& loc);
     344             :   virtual casacore::MPosition& getLocation();
     345             : 
     346             :   // set a moving source aka planets or comets =>  adjust phase center
     347             :   // on the fly for gridding
     348             :   virtual void setMovingSource(const casacore::String& sourcename, const casacore::String& ephemtable="");
     349             :   virtual void setMovingSource(const casacore::MDirection& mdir);
     350             : 
     351             :   //reset stuff in an FTMachine
     352             :   virtual void reset();
     353             : 
     354             :   //set frequency interpolation type
     355             :   virtual void setFreqInterpolation(const casacore::String& method);
     356             :   virtual void setFreqInterpolation(const casacore::InterpolateArray1D<casacore::Double,casacore::Complex>::InterpolationMethod type);
     357             :   //tell ftmachine which Pointing table column to use for Direction
     358             :   //Mosaic or Single dish ft use this for example
     359             :   virtual void setPointingDirColumn(const casacore::String& column="DIRECTION");
     360             : 
     361             :   virtual casacore::String getPointingDirColumnInUse();
     362             : 
     363             :   virtual void setSpwChanSelection(const casacore::Cube<casacore::Int>& spwchansels);
     364             :   virtual void setSpwFreqSelection(const casacore::Matrix<casacore::Double>& spwfreqs);
     365             : 
     366             :   // set the order of the Taylor term for MFS this is to tell
     367             :   // A-casacore::Projection to qualify the accumulated avgPB for each Taylor
     368             :   // term in the CFCache.
     369             :   virtual void setMiscInfo(const casacore::Int qualifier)=0;
     370             : 
     371           0 :   virtual void setCanComputeResiduals(casacore::Bool& b) {canComputeResiduals_p=b;};
     372           0 :   virtual casacore::Bool canComputeResiduals() {return canComputeResiduals_p;};
     373             :   //
     374             :   // Make the VB and VBStore interefaces for the interim re-factoring
     375             :   // work.  Finally removed the VB interface.
     376             :   virtual void ComputeResiduals(vi::VisBuffer2&vb, casacore::Bool useCorrected) = 0;
     377           0 :   virtual casacore::Float getPBLimit() {return pbLimit_p;};
     378             :   //virtual void ComputeResiduals(VBStore& vb)=0;
     379             :   //get and set numthreads
     380             :   void setnumthreads(casacore::Int n);
     381             :   casacore::Int getnumthreads();
     382             : 
     383             :   virtual void setCFCache(casacore::CountedPtr<CFCache>& cfc, const casacore::Bool resetCFC=true);
     384           0 :   casacore::CountedPtr<CFCache> getCFCache() {return cfCache_p;};
     385             :   casacore::String getCacheDir() { return cfCache_p->getCacheDir(); };
     386             : 
     387           0 :   virtual void setDryRun(casacore::Bool val) {isDryRun=val;};
     388           0 :   virtual casacore::Bool dryRun() {return isDryRun;}
     389           0 :   virtual casacore::Bool isUsingCFCache() {return (cfCache_p.nrefs()!=0);}
     390             : 
     391           0 :   virtual const casacore::CountedPtr<refim::FTMachine>& getFTM2(const casacore::Bool )
     392           0 :   {throw(casacore::AipsError("FTMachine::getFTM2() called directly!"));}
     393             : 
     394             :   casacore::Bool isDryRun;
     395           0 :   void setPseudoIStokes(casacore::Bool pseudoI){isPseudoI_p=pseudoI;};
     396             : 
     397             :    //set and get Time to calculate phasecenter  -1.0 means using the time available at
     398             :   //each iteration..this is used when the phasecenter in the field table is either
     399             :   //a polynomial or has a ephemerides tables associated with it
     400             :   //Using double in the units and epoch-frame of the ms(s) ..caller is responsible for conversion
     401             :   void setPhaseCenterTime(const casacore::Double time){phaseCenterTime_p=time;};
     402             :   casacore::Double getPhaseCenterTime(){return phaseCenterTime_p;};
     403             :   casacore::Vector<casacore::Int> channelMap(const vi::VisBuffer2& vb);
     404           0 :   casacore::Matrix<casacore::Double> getSumWeights(){return  sumWeight;};
     405             : 
     406             :   ///Functions associated with Briggs weighting for cubes
     407           0 :   void setBriggsCubeWeight(casacore::CountedPtr<refim::BriggsCubeWeightor> bwght){briggsWeightor_p=bwght;};
     408             :   void getImagingWeight(casacore::Matrix<casacore::Float>& imwght, const vi::VisBuffer2& vb);
     409             :   ///utility function that returns a rough estimate of memory needed.
     410             :   virtual casacore::Long estimateRAM(const casacore::CountedPtr<SIImageStore>& imstore);
     411             :   ///call this to clear temporary file
     412             :   // for e.g imaging weight column associated with this ftmachine
     413             :   virtual casacore::Vector<casacore::String> cleanupTempFiles(const casacore::String& message);
     414             : 
     415           0 :   virtual void setFTMType(const FTMachine::Type& type) {ftmType_p=type;};
     416           0 :   virtual void setPBReady(const bool& isready) {avgPBReady_p=isready;};
     417             : protected:
     418             : 
     419             :   friend class VisModelData;
     420             :   friend class MultiTermFT;
     421             :   friend class MultiTermFTNew;
     422             :   friend class BriggsCubeWeightor;
     423             :   casacore::LogIO logIO_p;
     424             : 
     425             :   casacore::LogIO& logIO();
     426             : 
     427             :   casacore::ImageInterface<casacore::Complex>* image;
     428             : 
     429             :   casacore::UVWMachine* uvwMachine_p;
     430             :   casacore::CountedPtr<casacore::UVWMachine> phaseShifter_p;
     431             : 
     432             :   casacore::MeasFrame mFrame_p;
     433             : 
     434             :   // Direction of desired tangent plane
     435             :   casacore::Bool tangentSpecified_p;
     436             :   casacore::MDirection mTangent_p;
     437             : 
     438             :   casacore::MDirection mImage_p;
     439             : 
     440             :   // moving source stuff
     441             :   casacore::MDirection movingDir_p;
     442             :   casacore::Bool fixMovingSource_p;
     443             :   casacore::String ephemTableName_p;
     444             :   casacore::MDirection firstMovingDir_p;
     445             :   // This will hold the angular difference between movingDir and firstMovingDir with
     446             :   // the frame conversion done properly etc..
     447             :   casacore::MVDirection movingDirShift_p;
     448             : 
     449             :   casacore::Double distance_p;
     450             : 
     451             :   casacore::uInt nAntenna_p;
     452             : 
     453             :   casacore::Int lastFieldId_p;
     454             :   casacore::Int lastMSId_p;
     455             :   casacore::CountedPtr<casacore::MSColumns> romscol_p;
     456             :   //Use douple precision grid in gridding process
     457             :   casacore::Bool useDoubleGrid_p;
     458             : 
     459             :   virtual void initMaps(const vi::VisBuffer2& vb);
     460             : 
     461             :   virtual void initUVWMachine(const vi::VisBuffer2& vb);
     462             : 
     463             :   virtual void initPolInfo(const vi::VisBuffer2& vb);
     464             : 
     465             :   // Sum of weights per polarization and per chan
     466             :   casacore::Matrix<casacore::Double> sumWeight, sumCFWeight;
     467             : 
     468             :   // Sizes
     469             :   casacore::Int nx, ny, npol, nchan, nvischan, nvispol;
     470             : 
     471             :   // Maps of channels and polarization
     472             :   casacore::Vector<casacore::Int> chanMap, polMap;
     473             : 
     474             :   // Stokes pseudo I only? single parallel flagged will be allowed.
     475             :   casacore::Bool isPseudoI_p;
     476             : 
     477             :   // Default Position used for phase rotations
     478             :   casacore::MPosition mLocation_p;
     479             : 
     480             :   // Set if uvwrotation is necessary
     481             : 
     482             :   casacore::Bool doUVWRotation_p;
     483             :   virtual void ok();
     484             : 
     485             :   // check if image is big enough for gridding
     486             : 
     487             :   virtual void gridOk (casacore::Int gridsupport);
     488             : 
     489             : 
     490             :   // setup multiple spectral window for cubes
     491             :   //casacore::Block <casacore::Vector <casacore::Int> > multiChanMap_p;
     492             :   //casacore::Vector<casacore::Int> selectedSpw_p;
     493             :   casacore::Vector<casacore::Int> nVisChan_p;
     494             :   casacore::Bool matchChannel(const casacore::Int& spw,
     495             :                     const VisBuffer& vb);
     496             :   casacore::Bool matchChannel(const vi::VisBuffer2& vb);
     497             :   casacore::Bool matchPol(const vi::VisBuffer2& vb);
     498             :   //redo all spw chan match especially if ms has changed underneath
     499             :   casacore::Bool matchAllSpwChans(const VisBuffer& vb);
     500             :   //casacore::Bool matchAllSpwChans(const vi::VisBuffer2& vb);
     501             :   //interpolate visibility data of vb to grid frequency definition
     502             :   //flag will be set the one as described in interpolateArray1D
     503             :   //return false if no interpolation is done...for e.g for nearest case
     504             : 
     505             :   virtual casacore::Bool interpolateFrequencyTogrid(const vi::VisBuffer2& vb,
     506             :                                           const casacore::Matrix<casacore::Float>& wt,
     507             :                                           casacore::Cube<casacore::Complex>& data,
     508             :                                           casacore::Cube<casacore::Int>& flag,
     509             :                                           casacore::Matrix<casacore::Float>& weight,
     510             :                                           FTMachine::Type type=FTMachine::OBSERVED );
     511             :   //degridded data interpolated back onto visibilities
     512             : 
     513             :   virtual casacore::Bool interpolateFrequencyFromgrid(vi::VisBuffer2& vb,
     514             :                                             casacore::Cube<casacore::Complex>& data,
     515             :                                             FTMachine::Type type=FTMachine::MODEL );
     516             : 
     517             :   //Interpolate visibilities to be degridded upon
     518             : 
     519             :   virtual void getInterpolateArrays(const vi::VisBuffer2& vb,
     520             :                                     casacore::Cube<casacore::Complex>& data, casacore::Cube<casacore::Int>& flag);
     521             : 
     522             : 
     523             :   void setSpectralFlag(const vi::VisBuffer2& vb, casacore::Cube<casacore::Bool>& modflagcube);
     524             :   //Save/Recover some elements of state of ftmachine in/from record
     525             :   casacore::Bool storeMovingSourceState(casacore::String& error, casacore::RecordInterface& outRecord);
     526             :   //helper to save Measures in a record
     527             :   casacore::Bool saveMeasure(casacore::RecordInterface& rec, const casacore::String& name, casacore::String& error, const casacore::Measure& ms);
     528             :   casacore::Bool recoverMovingSourceState(casacore::String& error, const casacore::RecordInterface& inRecord);
     529             :   casacore::Matrix<casacore::Double> negateUV(const vi::VisBuffer2& vb);
     530             : 
     531             :   // Private variables needed for spectral frame conversion
     532             :   casacore::SpectralCoordinate spectralCoord_p;
     533             :   casacore::Vector<casacore::Stokes::StokesTypes> visPolMap_p;
     534             :   //casacore::Vector<casacore::Bool> doConversion_p;
     535             :   casacore::Bool freqFrameValid_p;
     536             :   casacore::Vector<casacore::Double> imageFreq_p;
     537             :   //casacore::Vector of float lsrfreq needed for regridding
     538             :   casacore::Vector<casacore::Double> lsrFreq_p;
     539             :   casacore::Vector<casacore::Double> interpVisFreq_p;
     540             :   casacore::InterpolateArray1D<casacore::Double,casacore::Complex>::InterpolationMethod freqInterpMethod_p;
     541             :   casacore::String pointingDirCol_p;
     542             :   casacore::Cube<casacore::Int> spwChanSelFlag_p;
     543             :   casacore::Matrix<casacore::Double> spwFreqSel_p, expandedSpwFreqSel_p,expandedSpwConjFreqSel_p;
     544             :   casacore::Vector<casacore::Int> cfStokes_p;
     545             :   casacore::Int polInUse_p;
     546             :   casacore::CountedPtr<CFCache> cfCache_p;
     547             :   CFStore cfs_p, cfwts_p;
     548             :   casacore::CountedPtr<CFStore2> cfs2_p, cfwts2_p;
     549             : 
     550             :   casacore::CountedPtr<ConvolutionFunction> convFuncCtor_p;
     551             :   casacore::CountedPtr<PolOuterProduct> pop_p;
     552             : 
     553             :   casacore::Bool canComputeResiduals_p;
     554             :   casacore::Bool toVis_p;
     555             :   casacore::Int numthreads_p;
     556             : 
     557             :   // casacore::Array for non-tiled gridding
     558             :   // These are common to most FTmachines
     559             :   casacore::Array<casacore::Complex> griddedData;
     560             :   casacore::Array<casacore::DComplex> griddedData2;
     561             : 
     562             : 
     563             :   casacore::Float pbLimit_p;
     564             :   //  casacore::Vector<SkyJones *> sj_p;
     565             :   casacore::Vector<casacore::CountedPtr<SkyJones> > sj_p;
     566             :   //A holder for the complex image if nobody else is keeping it
     567             :   casacore::CountedPtr<casacore::ImageInterface<casacore::Complex> > cmplxImage_p;
     568             :   casacore::CountedPtr<VisBufferUtil> vbutil_p;
     569             :   casacore::Double phaseCenterTime_p;
     570             :   ///Some parameters and helpers for multithreaded gridders
     571             :   casacore::Int doneThreadPartition_p;
     572             :   casacore::Vector<casacore::Int> xsect_p, ysect_p, nxsect_p, nysect_p;
     573             :   casacore::CountedPtr<refim::BriggsCubeWeightor> briggsWeightor_p;
     574             :   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);
     575             : 
     576             :   virtual void tweakGridSector(const casacore::Int& nx, const casacore::Int& ny,
     577             :                                const casacore::Int& ixsub, const casacore::Int& iysub);
     578             :   void initSourceFreqConv();
     579             :   void shiftFreqToSource(casacore::Vector<casacore::Double>& freqs);
     580             :   ///moving source spectral frame stuff
     581             :   casacore::MRadialVelocity::Convert obsvelconv_p;
     582             :   casacore::MeasTable::Types mtype_p;
     583             :   FFT2D ft_p;
     584             :   casacore::Vector<casacore::String> tempFileNames_p;
     585             :   FTMachine::Type ftmType_p;
     586             :   casacore::Bool avgPBReady_p;
     587             : 
     588             : 
     589             :  private:
     590           0 :   virtual casacore::Bool isSD() const {return false;}
     591             : 
     592             :   //Some temporary wasteful function for swapping axes because we don't
     593             :   //Interpolation along the second axis...will need to implement
     594             :   //interpolation on y axis of a cube.
     595             : 
     596             :   void swapyz(casacore::Cube<casacore::Complex>& out, const casacore::Cube<casacore::Complex>& in);
     597             :   void swapyz(casacore::Cube<casacore::Complex>& out, const casacore::Cube<casacore::Bool>& outFlag, const casacore::Cube<casacore::Complex>& in);
     598             :   void swapyz(casacore::Cube<casacore::Bool>& out, const casacore::Cube<casacore::Bool>& in);
     599             :   void convUVW(casacore::Double& dphase, casacore::Vector<casacore::Double>& thisrow);
     600             : };
     601             : 
     602             : #include <synthesis/TransformMachines/FTMachine.tcc>
     603             : 
     604             :   }//# end namespace refim
     605             : } // end namespace casa
     606             : #endif
     607             : 
     608             : 
     609             : 

Generated by: LCOV version 1.16