LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - MultiTermFT.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 8 0.0 %
Date: 2024-10-12 00:35:29 Functions: 0 6 0.0 %

          Line data    Source code
       1             : //# MultiTermFT.h: Definition for MultiTermFT
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2002
       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_MULTITERMFT_H
      30             : #define SYNTHESIS_MULTITERMFT_H
      31             : 
      32             : #include <synthesis/TransformMachines/FTMachine.h>
      33             : #include <casacore/casa/Arrays/Matrix.h>
      34             : #include <casacore/scimath/Mathematics/FFTServer.h>
      35             : #include <msvis/MSVis/VisBuffer.h>
      36             : #include <casacore/images/Images/ImageInterface.h>
      37             : #include <casacore/images/Images/ImageInterface.h>
      38             : #include <casacore/casa/Containers/Block.h>
      39             : #include <casacore/casa/Arrays/Array.h>
      40             : #include <casacore/casa/Arrays/Vector.h>
      41             : #include <casacore/casa/Arrays/Matrix.h>
      42             : #include <casacore/scimath/Mathematics/ConvolveGridder.h>
      43             : #include <casacore/lattices/Lattices/LatticeCache.h>
      44             : #include <casacore/lattices/Lattices/ArrayLattice.h>
      45             : //#include <synthesis/MeasurementComponents/SynthesisPeek.h>
      46             : #include <casacore/casa/OS/Timer.h>
      47             : 
      48             : namespace casacore{
      49             : 
      50             : class UVWMachine;
      51             : }
      52             : 
      53             : namespace casa { //# NAMESPACE CASA - BEGIN
      54             : 
      55             : 
      56             : class MultiTermFT : public FTMachine {
      57             : public:
      58             : 
      59             :   // Construct using an existing FT-Machine 
      60             :   MultiTermFT(FTMachine *subftm, casacore::String subFTMname, casacore::Int nterms=1, casacore::Double reffreq=0.0);
      61             : 
      62             :   // Construct from a casacore::Record containing the MultiTermFT state
      63             :   MultiTermFT(const casacore::RecordInterface& stateRec);
      64             : 
      65             :   // Copy constructor. 
      66             :   // This first calls the default "=" operator, and then instantiates objects for member pointers.
      67             :   MultiTermFT(const MultiTermFT &other);
      68             : 
      69             :   // Assignment operator --- leave it as the default
      70             :   MultiTermFT &operator=(const MultiTermFT &other);
      71             : 
      72             :   // Destructor
      73             :   ~MultiTermFT();
      74             : 
      75             :   // Called at the start of de-gridding : subftm->initializeToVis()
      76             :   // Note : Pre-de-gridding model-image divisions by PBs will go here.
      77             :   void initializeToVis(casacore::ImageInterface<casacore::Complex>& image, const VisBuffer& vb);
      78             : 
      79             :   // Called at the end of de-gridding : subftm->finalizeToVis()
      80             :   void finalizeToVis();
      81             : 
      82             :   // Called at the start of gridding : subftm->initializeToSky()
      83             :   void initializeToSky(casacore::ImageInterface<casacore::Complex>& image,  casacore::Matrix<casacore::Float>& weight,  const VisBuffer& vb);
      84             : 
      85             :   // Called at the end of gridding : subftm->finalizeToSky()
      86             :   void finalizeToSky();
      87             : 
      88             :   // Do the degridding via subftm->get() and modify model-visibilities by Taylor-weights
      89             :   void get(VisBuffer& vb, casacore::Int row=-1);
      90             : 
      91             :   // Modify imaging weights with Taylor-weights and do gridding via subftm->put()
      92             :   void put(VisBuffer& vb, casacore::Int row=-1, casacore::Bool dopsf=false,
      93             :            FTMachine::Type type=FTMachine::OBSERVED);
      94             : 
      95             :   // Have a const version for compatibility with other FTMs.. Throw an exception if called.
      96           0 :   void put(const VisBuffer& /*vb*/, casacore::Int /*row=-1*/, casacore::Bool /*dopsf=false*/,
      97             :            FTMachine::Type /*type=FTMachine::OBSERVED*/)
      98           0 :   {throw(casacore::AipsError("MultiTermFT::put called with a const vb. This FTM needs to modify the vb."));};
      99             : 
     100             :   // Calculate residual visibilities if possible.
     101             :   // The purpose is to allow rGridFT to make this multi-threaded
     102             :   virtual void ComputeResiduals(VisBuffer&vb, casacore::Bool useCorrected); 
     103             : 
     104             :   // Make an image : subftm->makeImage()
     105             :   void makeImage(FTMachine::Type type,
     106             :                  VisSet& vs,
     107             :                  casacore::ImageInterface<casacore::Complex>& image,
     108             :                  casacore::Matrix<casacore::Float>& weight);
     109             :   
     110             :   // Get the final image: do the Fourier transform grid-correct, then 
     111             :   // optionally normalize by the summed weights
     112             :   // Note : Post-gridding residual-image divisions by PBs will go here.
     113             :   //           For now, it just calls subftm->getImage()
     114             :   casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>&, casacore::Bool normalize=true);
     115             : 
     116             :   // Place-holder for possible use with AWProject and AWProjectWB FTMs
     117           0 :   virtual void normalizeImage(casacore::Lattice<casacore::Complex>& /*skyImage*/,
     118             :                               const casacore::Matrix<casacore::Double>& /*sumOfWts*/,
     119             :                               casacore::Lattice<casacore::Float>& /*sensitivityImage*/,
     120             :                               casacore::Bool /*fftNorm*/)
     121           0 :     {throw(casacore::AipsError("MultiTermFT::normalizeImage() is not implemented"));}
     122             : 
     123             :   // Get the final weights image - this will hold PB2
     124             :   void getWeightImage(casacore::ImageInterface<casacore::Float>&, casacore::Matrix<casacore::Float>&);
     125             : 
     126             :   // Save and restore the MultiTermFT to and from a record
     127             :   virtual casacore::Bool toRecord(casacore::String& error, casacore::RecordInterface& outRec, casacore::Bool withImage=false, const casacore::String diskimage="");
     128             :   virtual casacore::Bool fromRecord(casacore::String& error, const casacore::RecordInterface& inRec);
     129             : 
     130             :   // Various small inline functions
     131           0 :   virtual casacore::Bool isFourier() {return true;}
     132           0 :   virtual void setNoPadding(casacore::Bool nopad){subftm_p->setNoPadding(nopad);};
     133           0 :   virtual casacore::String name() const {return machineName_p;};
     134           0 :   virtual void setMiscInfo(const casacore::Int qualifier){thisterm_p=qualifier;};
     135             : 
     136             : protected:
     137             : 
     138             :   // Multiply Imaging weights by Taylor-function weights - during "put"
     139             :   casacore::Bool modifyVisWeights(VisBuffer& vb);
     140             :   // Multiply model visibilities by Taylor-function weights - during "get"
     141             :   casacore::Bool modifyModelVis(VisBuffer &vb);
     142             :   // Restore vb.imagingweights to the original
     143             :   casacore::Bool restoreImagingWeights(VisBuffer &vb);
     144             :   // have to call the initmaps of subftm
     145             :   virtual void initMaps(const VisBuffer& vb);
     146             :   //// New MTFT specific internal parameters and functions
     147             :   casacore::CountedPtr<FTMachine> subftm_p; 
     148             :   casacore::String  subFTMname_p;
     149             :   casacore::Int nterms_p;
     150             :   casacore::Int thisterm_p;
     151             :   casacore::Double reffreq_p;
     152             : 
     153             :   casacore::Matrix<casacore::Float> imweights_p;
     154             :   casacore::Double sumwt_p;
     155             :   casacore::String machineName_p;
     156             : 
     157             :   casacore::Bool dbg_p,dotime_p;
     158             :   casacore::Timer tmr_p;
     159             :   casacore::Double time_get, time_put, time_res;
     160             : };
     161             : 
     162             : } //# NAMESPACE CASA - END
     163             : 
     164             : #endif

Generated by: LCOV version 1.16