LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - AWProjectWBFT.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 12 0.0 %
Date: 2024-10-04 18:58:15 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# AWProjectWBFT.h: Definition for AWProjectWBFT
       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_AWPROJECTWBFT_H
      30             : #define SYNTHESIS_AWPROJECTWBFT_H
      31             : #define DELTAPA 1.0
      32             : #define MAGICPAVALUE -999.0
      33             : 
      34             : 
      35             : #include <synthesis/TransformMachines/AWProjectFT.h>
      36             : 
      37             : namespace casa { //# NAMESPACE CASA - BEGIN
      38             :   
      39             :   class EPJones;
      40             : 
      41             :   class AWProjectWBFT : public AWProjectFT {
      42             : 
      43             :   public:
      44             :     //
      45             :     // Constructor: cachesize is the size of the cache in words
      46             :     // (e.g. a few million is a good number), tilesize is the size of
      47             :     // the tile used in gridding (cannot be less than 12, 16 works in
      48             :     // most cases).  
      49             :     // <group>
      50             :     //
      51             :     AWProjectWBFT(casacore::Int nFacets, casacore::Long cachesize,
      52             :                   casacore::CountedPtr<CFCache>& cfcache,
      53             :                   casacore::CountedPtr<ConvolutionFunction>& cf,
      54             :                   casacore::CountedPtr<VisibilityResamplerBase>& visResampler,
      55             :                   casacore::Bool applyPointingOffset=true,
      56             :                   casacore::Bool doPBCorr=true,
      57             :                   casacore::Int tilesize=16, 
      58             :                   casacore::Float paSteps=5.0, 
      59             :                   casacore::Float pbLimit=5e-4,
      60             :                   casacore::Bool usezero=false,
      61             :                   casacore::Bool conjBeams_p=true,
      62             :                   casacore::Bool doublePrecGrid=false);
      63             :     // </group>
      64             :     
      65             :     // Construct from a casacore::Record containing the AWProjectWBFT state
      66             :     AWProjectWBFT(const casacore::RecordInterface& stateRec);
      67             :     
      68             :     // Copy constructor
      69           0 :     AWProjectWBFT(const AWProjectWBFT &other):AWProjectFT() {operator=(other);};
      70             : 
      71             :     // Assignment operator
      72             :     AWProjectWBFT &operator=(const AWProjectWBFT &other);
      73             :     
      74           0 :     ~AWProjectWBFT() {};
      75             : 
      76           0 :     virtual casacore::String name() const {return "AWProjectWBFT";};
      77             : 
      78             : 
      79             :     casacore::Int findPointingOffsets(const VisBuffer& vb, casacore::Array<casacore::Float> &l_off, casacore::Array<casacore::Float> &m_off,
      80             :                             casacore::Bool Evaluate);
      81             :     void normalizeAvgPB();
      82           0 :     void normalizeAvgPB(casacore::ImageInterface<casacore::Complex>& /*inImage*/, casacore::ImageInterface<casacore::Float>& /*outImage*/) 
      83           0 :     {throw(casacore::AipsError("AWPWBFT::normalizeAvgPB(Complex,Float)"));}
      84             : 
      85             :     //
      86             :     // This method is called from AWProjectFT to compute the
      87             :     // sensitivity image by accumulating in the image domain
      88             :     // (i.e. directly accumulate the Primay Beam functions).  This is
      89             :     // called from findConvFunction() so that sensitivity pattern is
      90             :     // also pre-computed along with the convolution functions.  This
      91             :     // in-turn calls the ATerm::makeAverageResponse().
      92             :     //
      93             :     // For AWProjectWBFT class of FTMachines, this just issues a log
      94             :     // message indicating that this is only setting up things for
      95             :     // accumulation of weight images in the first gridding cycle.  The
      96             :     // actual sensitivity patterns are computed by overloaded function
      97             :     // below.
      98             :     //
      99             :     virtual void makeSensitivityImage(const VisBuffer& vb, 
     100             :                                       const casacore::ImageInterface<casacore::Complex>& imageTemplate,
     101             :                                       casacore::ImageInterface<casacore::Float>& sensitivityImage);
     102             :     //
     103             :     // In AWProjectWBFT and its derivatives, sensitivity image is
     104             :     // computed by accumulating weight functions (images) during the
     105             :     // first gridding cycle.  AWProjectFT::makeSensitivityImage() is
     106             :     // overloaded in AWProjectWBFT and only issues a log message.
     107             :     //
     108             :     // The following method is used to Fourier transform normalize the
     109             :     // accumulated weight images.  doFFTNorm when true, the FFT
     110             :     // normalization (by pixel volume) is also done.
     111             :     //
     112             :     virtual void makeSensitivityImage(casacore::Lattice<casacore::Complex>& wtImage,
     113             :                                       casacore::ImageInterface<casacore::Float>& sensitivityImage,
     114             :                                       const casacore::Matrix<casacore::Float>& sumWt=casacore::Matrix<casacore::Float>(),
     115             :                                       const casacore::Bool& doFFTNorm=true);
     116             :     virtual void makeSensitivitySqImage(casacore::Lattice<casacore::Complex>& wtImage,
     117             :                                         casacore::ImageInterface<casacore::Complex>& sensitivitySqImage,
     118             :                                         const casacore::Matrix<casacore::Float>& sumWt=casacore::Matrix<casacore::Float>(),
     119             :                                         const casacore::Bool& doFFTNorm=true);
     120             : 
     121             :     //
     122             :     // Method used to make normalized image from gridded visibilites.
     123             :     // This calls makeSensitivityImage() to make the sensitivity image
     124             :     // and AWProjectFT::getImage() to make the image from gridded
     125             :     // visibilites.  AWProjectFT::getImage() internally calls
     126             :     // normalizeImage() which uses the sensitivty image computed by
     127             :     // makeSensitivtyImage().
     128             :     //
     129             :     virtual casacore::ImageInterface<casacore::Complex>& getImage(casacore::Matrix<casacore::Float>&, casacore::Bool normalize=true);
     130             :     //
     131             :     // Method used to convert the pixel value of the PB image, passed
     132             :     // as pbPixValue, to a value used for PB-normalization.
     133             :     // Typically, this will depend on the units of the "PB image"
     134             :     // constructed by the makeSensitivtyImage() methods. pbLimit is
     135             :     // the fractional pb-gain below which imaging is not required
     136             :     // (this value is typically the user-defined parameter in the
     137             :     // private member variable pbLimit_p).
     138             :     //
     139           0 :     inline virtual casacore::Float pbFunc(const casacore::Float& /*pbPixValue*/, const casacore::Float& /*pbLimit*/) 
     140           0 :     {return  1.0;};
     141             :     //   {casacore::Float tt=(pbPixValue);return  (abs(tt) >= pbLimit)?tt:1.0;};
     142             :  
     143             : 
     144             :    //    {casacore::Float tt=sqrt(pbPixValue);return  (abs(tt) >= pbLimit)?tt:1.0;};
     145             : 
     146             :     virtual void finalizeToSky();
     147             :     virtual void initializeToSky(casacore::ImageInterface<casacore::Complex>& image,  casacore::Matrix<casacore::Float>& weight,
     148             :                                  const VisBuffer& vb);
     149             : 
     150           0 :     void setObservatoryLocation(const casacore::MPosition& mLocation) {mLocation_p=mLocation;};
     151             : 
     152           0 :     virtual casacore::Bool verifyShapes(casacore::IPosition shape0, casacore::IPosition shape1)
     153           0 :     {(void)shape0; (void)shape1;return false;};
     154             : 
     155             :     //
     156             :     // Returns true if accumulation during gridding to compute the
     157             :     // average PB must be done.
     158             :     //
     159           0 :     virtual casacore::Bool computeAvgPB(const casacore::Double& /*actualPA*/, const casacore::Double& /*lastPAUsedForWtImg*/) 
     160           0 :     {return (avgPBReady_p==false);};
     161             : 
     162             :     // virtual void setMiscInfo(const casacore::Int qualifier)
     163             :     // {sensitivityPatternQualifier_p=qualifier;}
     164             :     //    {qualifier_p = qualifier;taylorQualifier_p = "_MFS_"+casacore::String::toString(qualifier_p)+"_";};
     165             : 
     166             :     //  virtual void ComputeResiduals(VisBuffer&vb, casacore::Bool useCorrected) {};
     167             :     virtual void setCFCache(casacore::CountedPtr<CFCache>& cfc, const casacore::Bool resetCFC=true);
     168             : 
     169             :   protected:
     170             :     virtual void ftWeightImage(casacore::Lattice<casacore::Complex>& wtImage, 
     171             :                                const casacore::Matrix<casacore::Float>& sumWt,
     172             :                                const casacore::Bool& doFFTNorm);
     173             : 
     174             :     virtual void resampleDataToGrid(casacore::Array<casacore::Complex>& griddedData,VBStore& vbs, 
     175             :                                     const VisBuffer& vb, casacore::Bool& dopsf);
     176             :     virtual void resampleDataToGrid(casacore::Array<casacore::DComplex>& griddedData,VBStore& vbs, 
     177             :                                     const VisBuffer& vb, casacore::Bool& dopsf);
     178             :     //    virtual void resampleGridToData(VBStore& vbs, const VisBuffer& vb);
     179             :     void resampleCFToGrid(casacore::Array<casacore::Complex>& wtsGrid, 
     180             :                           VBStore& vbs, const VisBuffer& vb);
     181             : 
     182             :     casacore::Bool avgPBReady_p,resetPBs_p, wtImageFTDone_p;
     183             : 
     184             :   private:
     185             :     casacore::String tt_pp;
     186             :     casacore::Vector<casacore::Int> fieldIds_p;
     187             :     casacore::TempImage<casacore::Complex> griddedWeights, griddedConjWeights;
     188             :     CFStore rotatedCFWts_p;
     189             :     casacore::CountedPtr<VisibilityResamplerBase> visResamplerWt_p;
     190             :     // //
     191             :     // // These ugly methods (ugly due to their flirtation with FORTRAN) should go!
     192             :     // //
     193             :     // virtual void runFortranGet(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
     194             :     //                         casacore::Cube<casacore::Complex>& visdata,
     195             :     //                         casacore::IPosition& s,
     196             :     //                         casacore::Int& Conj,
     197             :     //                         casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
     198             :     //                         casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
     199             :     //                         casacore::Array<casacore::Complex>* dataPtr,
     200             :     //                         casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
     201             :     //                         VisBuffer& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
     202             :     //                         casacore::Double& sigma,
     203             :     //                         casacore::Array<casacore::Float>& raoffsets,
     204             :     //                         casacore::Array<casacore::Float>& decoffsets,
     205             :     //                         casacore::Double area,
     206             :     //                         casacore::Int& doGrad,casacore::Int paIndex);
     207             :     // virtual void runFortranPut(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
     208             :     //                         const casacore::Complex& visdata_p,
     209             :     //                         casacore::IPosition& s,
     210             :     //                         casacore::Int& Conj,
     211             :     //                         casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
     212             :     //                         const casacore::Matrix<casacore::Float>& weight,
     213             :     //                         casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
     214             :     //                         casacore::Array<casacore::Complex>& dataPtr,
     215             :     //                         casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
     216             :     //                         const VisBuffer& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
     217             :     //                         casacore::Double& sigma,
     218             :     //                         casacore::Array<casacore::Float>& raoffsets,
     219             :     //                         casacore::Array<casacore::Float>& decoffsets,
     220             :     //                         casacore::Matrix<casacore::Double>& sumWeight,
     221             :     //                         casacore::Double& area,
     222             :     //                         casacore::Int& doGrad,
     223             :     //                         casacore::Int& doPSF,casacore::Int paIndex);
     224             :     // virtual void runFortranGetGrad(casacore::Matrix<casacore::Double>& uvw,casacore::Vector<casacore::Double>& dphase,
     225             :     //                             casacore::Cube<casacore::Complex>& visdata,
     226             :     //                             casacore::IPosition& s,
     227             :     //                             casacore::Cube<casacore::Complex>& gradVisAzData,
     228             :     //                             casacore::Cube<casacore::Complex>& gradVisElData,
     229             :     //                             casacore::Int& Conj,
     230             :     //                             casacore::Cube<casacore::Int>& flags,casacore::Vector<casacore::Int>& rowFlags,
     231             :     //                             casacore::Int& rownr,casacore::Vector<casacore::Double>& actualOffset,
     232             :     //                             casacore::Array<casacore::Complex>* dataPtr,
     233             :     //                             casacore::Int& aNx, casacore::Int& aNy, casacore::Int& npol, casacore::Int& nchan,
     234             :     //                             VisBuffer& vb,casacore::Int& Nant_p, casacore::Int& scanNo,
     235             :     //                             casacore::Double& sigma,
     236             :     //                             casacore::Array<casacore::Float>& l_off,
     237             :     //                             casacore::Array<casacore::Float>& m_off,
     238             :     //                             casacore::Double area,
     239             :     //                             casacore::Int& doGrad,
     240             :     //                             casacore::Int paIndex);
     241             :     casacore::Bool oneTimeMessage_p;
     242             :   };
     243             : } //# NAMESPACE CASA - END
     244             : 
     245             : #endif

Generated by: LCOV version 1.16