LCOV - code coverage report
Current view: top level - synthesis/ImagerObjects - SIImageStoreMultiTerm.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 9 0.0 %
Date: 2024-10-10 15:00:01 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# SIImageStore.h: Imager functionality sits here; 
       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 addressed 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             : //#
      25             : //# $Id$
      26             : 
      27             : #ifndef SYNTHESIS_SIIMAGESTOREMULTITERM_H
      28             : #define SYNTHESIS_SIIMAGESTOREMULTITERM_H
      29             : 
      30             : #include <casacore/casa/aips.h>
      31             : #include <casacore/casa/OS/Timer.h>
      32             : #include <casacore/casa/Containers/Record.h>
      33             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
      34             : #include <casacore/casa/Arrays/IPosition.h>
      35             : #include <casacore/casa/Quanta/Quantum.h>
      36             : #include <casacore/measures/Measures/MDirection.h>
      37             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      38             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      39             : #include <casacore/images/Images/PagedImage.h>
      40             : #include <casacore/images/Images/TempImage.h>
      41             : #include <casacore/images/Images/SubImage.h>
      42             : #include <casacore/images/Regions/ImageRegion.h>
      43             : #include <casacore/casa/BasicSL/Constants.h>
      44             : 
      45             : #include <synthesis/ImagerObjects/SIImageStore.h>
      46             : 
      47             : namespace casa { //# NAMESPACE CASA - BEGIN
      48             : 
      49             : 
      50             :   class SIImageStoreMultiTerm: public SIImageStore 
      51             : {
      52             :  public:
      53             :   // Default constructor
      54             : 
      55             :   SIImageStoreMultiTerm();
      56             :   SIImageStoreMultiTerm(const casacore::String &imagename, casacore::uInt ntaylorterms=1,
      57             :                         const casacore::Bool ignorefacets=casacore::False,
      58             :                         const casacore::Bool ignoresumwt=casacore::False);
      59             : 
      60             :   SIImageStoreMultiTerm(const casacore::String &imagename,
      61             :                         const casacore::CoordinateSystem &imcoordsys,
      62             :                         const casacore::IPosition &imshape,
      63             :                         const casacore::String &objectname,
      64             :                         const casacore::Record &miscinfo,
      65             :                         const int nfacets,
      66             :                         const casacore::Bool overwrite=false,
      67             :                         casacore::uInt ntaylorterms=1,casacore::Bool useweightimage=false);
      68             : 
      69             :   /*
      70             :   SIImageStoreMultiTerm(casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >modelims, 
      71             :                         casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >residims,
      72             :                         casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >psfims, 
      73             :                         casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >weightims, 
      74             :                         casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >restoredims,
      75             :                         casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > >sumwtims, 
      76             :                         std::shared_ptr<casacore::ImageInterface<casacore::Float> > newmask,
      77             :                         std::shared_ptr<casacore::ImageInterface<casacore::Float> > newalpha,
      78             :                         std::shared_ptr<casacore::ImageInterface<casacore::Float> > newbeta);
      79             :   */
      80             : 
      81             :  SIImageStoreMultiTerm(const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &modelims,
      82             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &residims,
      83             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &psfims,
      84             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &weightims,
      85             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &restoredims,
      86             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > &sumwtims,
      87             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<float> > > &pbims,
      88             :                        const casacore::Block<std::shared_ptr<casacore::ImageInterface<float> > > &restoredpbcorims,
      89             :                        const std::shared_ptr<casacore::ImageInterface<casacore::Float> > &newmask,
      90             :                        const std::shared_ptr<casacore::ImageInterface<casacore::Float> > &newalpha,
      91             :                        const std::shared_ptr<casacore::ImageInterface<casacore::Float> > &newbeta,
      92             :                        const std::shared_ptr<casacore::ImageInterface<casacore::Float> > &newalphaerror,
      93             :                        const std::shared_ptr<casacore::ImageInterface<float> > &newalphapbcor,
      94             :                        const std::shared_ptr<casacore::ImageInterface<float> > &newbetapbcor,
      95             :                        const casacore::CoordinateSystem &csys,
      96             :                        const casacore::IPosition &imshape,
      97             :                        const casacore::String &imagename,
      98             :                        const casacore::String &objectname,
      99             :                        const casacore::Record &miscinfo,
     100             :                        const casacore::Int facet=0, const casacore::Int nfacets=1,
     101             :                        const casacore::Int chan=0, const casacore::Int nchanchunks=1,
     102             :                        const casacore::Int pol=0, const casacore::Int npolchunks=1);
     103             :   
     104             :   virtual void init();
     105             : 
     106             :   virtual ~SIImageStoreMultiTerm();
     107             : 
     108           0 :   virtual casacore::String getType(){return "multiterm";}
     109             : 
     110             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > psf(casacore::uInt term=0);
     111             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > residual(casacore::uInt term=0);
     112             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > weight(casacore::uInt term=0);
     113             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > model(casacore::uInt term=0);
     114             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > image(casacore::uInt term=0);
     115             :   virtual std::shared_ptr<casacore::ImageInterface<float> > pb(casacore::uInt term=0);
     116             :   virtual std::shared_ptr<casacore::ImageInterface<float> > imagepbcor(casacore::uInt term=0);
     117             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > sumwt(casacore::uInt term=0);
     118             :   ///   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > mask(casacore::uInt term=0); // take from base class.
     119             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Complex> > forwardGrid(casacore::uInt term=0);
     120             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Complex> > backwardGrid(casacore::uInt term=0);
     121             : 
     122             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > alpha();
     123             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > beta();
     124             :   virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > alphaerror();
     125             :   virtual std::shared_ptr<casacore::ImageInterface<float> > alphapbcor();
     126             :   virtual std::shared_ptr<casacore::ImageInterface<float> > betapbcor();
     127             : 
     128             :   //  virtual std::shared_ptr<casacore::ImageInterface<casacore::Float> > gridwt(casacore::uInt term=0);
     129             : 
     130             :   void setModelImage(const casacore::Vector<casacore::String> &modelnames );
     131             :   casacore::Vector<casacore::String> getModelImageName();
     132             : 
     133             :   casacore::Bool doesImageExist(casacore::String imagename);
     134             : 
     135             :   void resetImages( casacore::Bool resetpsf, casacore::Bool resetresidual, casacore::Bool resetweight );
     136             :   void addImages( std::shared_ptr<SIImageStore> imagestoadd, 
     137             :                   casacore::Bool addpsf, casacore::Bool addresidual, casacore::Bool addweight, casacore::Bool adddensity);
     138             : 
     139             :   void dividePSFByWeight(const casacore::Float pblimit=casacore::C::minfloat);
     140             :   void normalizePrimaryBeam(const float pblimit=casacore::C::minfloat);
     141             : 
     142             :   void divideResidualByWeight(const casacore::Float pblimit=casacore::C::minfloat, const casacore::String normtype="flatnoise");
     143             :   //  void divideSensitivityPatternByWeight();
     144             :   void divideModelByWeight(const casacore::Float pblimit=casacore::C::minfloat, const casacore::String normtype="flatnoise");
     145             :   void multiplyModelByWeight(const casacore::Float pblimit=casacore::C::minfloat, const casacore::String normtype="flatnoise");
     146             : 
     147             :   /*
     148             :   casacore::Bool checkValidity(const casacore::Bool ipsf, const casacore::Bool iresidual, const casacore::Bool iweight, 
     149             :                      const casacore::Bool imodel, const casacore::Bool irestored, const casacore::Bool imask=false, 
     150             :                      const casacore::Bool isumwt=true, const casacore::Bool ialpha=false, const casacore::Bool ibeta=false);
     151             :   */
     152             : 
     153             :   casacore::Bool releaseLocks();
     154             :   casacore::Bool releaseComplexGrids();
     155             : 
     156             :   virtual casacore::Double getReferenceFrequency();
     157             : 
     158             :   casacore::uInt getNTaylorTerms(casacore::Bool dopsf=false);  // {return dopsf ? (2*itsNTerms-1) : itsNTerms;};
     159             : 
     160             :   void restore(casacore::GaussianBeam& rbeam, casacore::String& usebeam,casacore::uInt term=0, casacore::Float psfcutoff=0.35 );
     161             :   void calculateAlphaBeta(casacore::String imtype);
     162             :   void pbcor();
     163             : 
     164             :   /*
     165             :   std::shared_ptr<SIImageStore> getFacetImageStore(const casacore::Int facet, const casacore::Int nfacets);
     166             :   std::shared_ptr<SIImageStore> getSubImageStoreOld(const casacore::Int chan, const casacore::Bool onechan, 
     167             :                                             const casacore::Int pol, const casacore::Bool onepol);
     168             :   */
     169             : 
     170             :   std::shared_ptr<SIImageStore> getSubImageStore(const casacore::Int facet=0, const casacore::Int nfacets=1, 
     171             :                                             const casacore::Int chan=0, const casacore::Int nchanchunks=1, 
     172             :                                             const casacore::Int pol=0, const casacore::Int npolchunks=1);
     173             :   
     174             :   
     175           0 :   virtual casacore::Bool hasSensitivity(){return itsWeights.nelements()>0 && itsWeights[0];}
     176             :   //  virtual casacore::Bool hasModel() {return itsModels.nelements()>0 && itsModels[0];}
     177           0 :   virtual casacore::Bool hasModel() {return doesImageExist(itsImageName+imageExts(MODEL)+casacore::String(".tt0"));}
     178           0 :   virtual casacore::Bool hasPsf(){return itsPsfs.nelements()>0 && itsPsfs[0];}
     179           0 :   virtual casacore::Bool hasResidual() {return itsResiduals.nelements()>0 && itsResiduals[0];}
     180           0 :   virtual casacore::Bool hasSumWt() {return itsSumWts.nelements()>0 && itsSumWts[0];}
     181             :   
     182             : 
     183             :   //  virtual Bool hasSensitivity() {return doesImageExist(itsImageName+imageExts(WEIGHT)+String(".tt0"));}
     184             :   //  virtual Bool hasModel() {return doesImageExist(itsImageName+imageExts(MODEL)+String(".tt0"));}
     185             :   //  virtual Bool hasMask() {return doesImageExist(itsImageName+imageExts(MASK)+String(".tt0"));}
     186             :   //  virtual Bool hasPsf() {return doesImageExist(itsImageName+imageExts(PSF)+String(".tt0"));}
     187           0 :   virtual bool hasResidualImage() {return doesImageExist(itsImageName+imageExts(RESIDUAL)+casacore::String(".tt0"));}
     188             :   //  virtual Bool hasSumWt() {return doesImageExist(itsImageName+imageExts(SUMWT)+String(".tt0"));}
     189           0 :   virtual bool hasRestored() {return doesImageExist(itsImageName+imageExts(IMAGE)+casacore::String(".tt0"));}
     190           0 :   virtual bool hasPB() {return doesImageExist(itsImageName+imageExts(PB)+casacore::String(".tt0"));}
     191             : 
     192             :   //  {return ( itsParentSumWts.nelements()==0 || itsParentSumWts[0].null() ) ? false : getUseWeightImage( *(itsParentSumWts[0]) ); };
     193             : 
     194             :   void calcSensitivity();
     195             :   virtual casacore::Bool isModelEmpty();
     196             : 
     197             :   virtual casacore::Double calcFractionalBandwidth();
     198             : 
     199             : protected:
     200             : 
     201             :   virtual void printImageStats();
     202             : 
     203             : private:
     204             : 
     205             :   casacore::uInt itsNTerms;
     206             : 
     207             :   casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > itsPsfs, itsModels, itsResiduals, itsWeights, itsImages, itsSumWts, itsImagePBcors, itsPBs;
     208             :   casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Complex> > > itsForwardGrids, itsBackwardGrids;
     209             :   std::shared_ptr<casacore::ImageInterface<casacore::Float> > itsAlpha, itsBeta, itsAlphaError, itsAlphaPBcor, itsBetaPBcor;
     210             : 
     211             :   casacore::Block<std::shared_ptr<casacore::ImageInterface<casacore::Float> > > itsParentPsfs, itsParentModels, itsParentResiduals, itsParentWeights, itsParentImages, itsParentSumWts, itsParentPBs, itsParentImagePBcors;
     212             : 
     213             : };
     214             : 
     215             : 
     216             : } //# NAMESPACE CASA - END
     217             : 
     218             : #endif

Generated by: LCOV version 1.16