LCOV - code coverage report
Current view: top level - synthesis/MeasurementComponents - EPJones.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 20 0.0 %
Date: 2024-12-11 20:54:31 Functions: 0 20 0.0 %

          Line data    Source code
       1             : //# EPJones.h: Declaration of EPJones (Solvable)VisCal type
       2             : //# Copyright (C) 1996,1997,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             : 
      28             : #ifndef SYNTHESIS_EPJONES_H
      29             : #define SYNTHESIS_EPJONES_H
      30             : 
      31             : #include <casacore/casa/aips.h>
      32             : #include <casacore/casa/Containers/Record.h>
      33             : #include <casacore/casa/BasicSL/Complex.h>
      34             : #include <synthesis/MeasurementComponents/SolvableVisCal.h>
      35             : #include <synthesis/MeasurementComponents/nPBWProjectFT.h>
      36             : #include <synthesis/MeasurementComponents/PBMosaicFT.h>
      37             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
      38             : #include <casacore/images/Images/PagedImage.h>
      39             : #include <casacore/images/Images/ImageInterface.h>
      40             : #include <casacore/images/Images/ImageInfo.h>
      41             : #include <synthesis/TransformMachines/StokesImageUtil.h>
      42             : #include <msvis/MSVis/VisSet.h>
      43             : #include <synthesis/CalTables/CalSet.h>
      44             : #include <casacore/casa/OS/Timer.h>
      45             : namespace casa { //# NAMESPACE CASA - BEGIN
      46             : 
      47             : // Forward declaration
      48             :   class VisEquation;
      49             :   class nPBWProjectFT;
      50             :   class PBMosaicFT;
      51             : 
      52             : // **********************************************************
      53             : //  EPJones (pointing errors)
      54             : //
      55             : 
      56             : class EPJones : public SolvableVisJones {
      57             : public:
      58             : 
      59             :   // Constructor
      60             :   EPJones(VisSet& vs);
      61             :          //  {throw(casacore::AipsError("Use the constructor EPJones(VisSet&, MeasurementSet&) instead"));};
      62             :   EPJones(VisSet& vs, casacore::MeasurementSet& ms);
      63             :   //   EPJones(const casacore::Int& nAnt);  // NYI
      64             : 
      65             :   virtual ~EPJones();
      66             : 
      67             :   // Return the type enum
      68           0 :   virtual Type type() { return VisCal::E; };
      69             : 
      70             :   // Return type name as string
      71           0 :   virtual casacore::String typeName()     { return "EP Jones"; };
      72           0 :   virtual casacore::String longTypeName() { return "EP Jones (pointing errors)"; };
      73             : 
      74             :   // Type of Jones matrix according to nPar()
      75           0 :   Jones::JonesType jonesType() { return Jones::Diagonal; };
      76             :   
      77           0 :   virtual VisCalEnum::VCParType parType() { return setParType(VisCalEnum::REAL);};
      78             : 
      79             :   // Specialized access to pointing parameters (no chan axis)
      80             :   casacore::Cube<casacore::Float>& loadPar();
      81             : 
      82             :   virtual void setModel(const casacore::String& modelImage);
      83             :   // Set the solving parameters
      84             :   virtual void setSolve();
      85             :   virtual void setSolve(const casacore::Record& solve);
      86           0 :   virtual void setNiter(const casacore::Int& niter) {niter_p=niter;}
      87           0 :   virtual void setTolerance(const casacore::Float& tol) {tolerance_p = tol;}
      88           0 :   virtual void setGain(const casacore::Float& gain) {gain_p = gain;}
      89             : 
      90             :   // Arrange to apply (corrupt only)
      91             :   using SolvableVisCal::setApply;
      92             :   virtual void setApply(const casacore::Record& applypar);
      93             : 
      94             :   // Apply calibration to a VisBuffer 
      95             :   virtual void applyCal(VisBuffer& vb, 
      96             :                         casacore::Cube<casacore::Complex>& Mout);
      97             : 
      98             :   // Differentiate a VisBuffer w.r.t. pointng parameters
      99             :   //
     100             :   // These effectively compute residuals and derivatives for
     101             :   // a time-averaged VisBuffer
     102             :   //
     103             :   virtual void differentiate(VisBuffer& vb,
     104             :                              casacore::Cube<casacore::Complex>& Mout,
     105             :                              casacore::Array<casacore::Complex>& dMout,
     106             :                              casacore::Matrix<casacore::Bool>& Mflg);
     107             :   // Differentiate a VisBuffer w.r.t. pointng parameters
     108             :   virtual void differentiate(VisBuffer& vb,
     109             :                              VisBuffer& dvb0,
     110             :                              VisBuffer& dvb1,
     111             :                              casacore::Matrix<casacore::Bool>& Mflg);
     112             :   //
     113             :   // This one averages the residuals and the derivatives in time.
     114             :   //
     115             :   virtual void diffResiduals(VisIter& vi, VisEquation& ve,
     116             :                             VisBuffer& residuals, 
     117             :                             VisBuffer& dVr1, 
     118             :                             VisBuffer& dVr2, 
     119             :                             casacore::Matrix<casacore::Bool>& flags);  
     120             :   // Guess (throws error because we don't yet solve for this)
     121             :   virtual void guessPar(VisBuffer& vb);
     122           0 :   virtual void guessPar() {pointPar_=0;}
     123             :   
     124           0 :   virtual casacore::Cube<casacore::Float>& solveRPar() {return pointPar_;}
     125           0 :   virtual void setRPar(casacore::Cube<casacore::Float>& val) {pointPar_.resize(val.shape());pointPar_=val;}
     126           0 :   virtual void setRPar(casacore::Double val) {pointPar_=val;}
     127             :   
     128             :   //  virtual void keep(const casacore::Int& slot);
     129             : 
     130           0 :   virtual casacore::Bool normalizable() { return false; };
     131             : 
     132             :   //  virtual BaseCalSet& cs() {return *rcs_;};
     133             :   virtual void keep(const casacore::Int& slot);
     134             :   
     135           0 :   inline virtual CalSet<casacore::Float>& rcs() {return *rcs_;};
     136             : 
     137             :   virtual void inflate(const casacore::Vector<casacore::Int>& nChan,
     138             :                        const casacore::Vector<casacore::Int>& startChan,
     139             :                        const casacore::Vector<casacore::Int>& nSlot);
     140             :   void initSolve(VisSet& vs);
     141             :   void initSolvePar();
     142             :   void store();
     143             :   void store(const casacore::String& table,const casacore::Bool& append);
     144             :   casacore::Bool verifyForSolve(VisBuffer& vb);
     145             :   virtual void postSolveMassage(const VisBuffer&);
     146             :   virtual void selfGatherAndSolve(VisSet& vs,VisEquation& ve);
     147           0 :   virtual casacore::Bool useGenericGatherForSolve() { return false; };
     148           0 :   virtual casacore::Float printFraction(const casacore::Int& ) {return 0.1;};
     149           0 :   casacore::Array<casacore::Float> getOffsets(const casacore::Int& spw) {return rcs().par(spw);}
     150           0 :   casacore::Array<casacore::Double> getTime(const casacore::Int& spw) {return rcs().time(spw);}
     151             :   void nearest(const casacore::Double time, casacore::Array<casacore::Float>& vals);
     152             :   void printRPar();  
     153             : 
     154             : protected:
     155             : 
     156             :   // EP has a pair of real parameters per feed
     157           0 :   virtual casacore::Int nPar() { return 4; };
     158             : 
     159             :   // Jones matrix elements are NOT trivial
     160           0 :   virtual casacore::Bool trivialJonesElem() { return false; };
     161             : 
     162             :   // Fill-in a complex grid with the image values in prepration for 
     163             :   // computing it's FT
     164             :   virtual void makeComplexGrid(casacore::TempImage<casacore::Complex>& Grid, 
     165             :                                         casacore::PagedImage<casacore::Float>& ModelImage,
     166             :                                         VisBuffer& vb);
     167             :   void printActivity(const casacore::Int slotNo, const casacore::Int fieldId, const casacore::Int spw, const casacore::Int nSolutions);
     168             :   //  inline virtual CalSet<casacore::Float> rcs() {return *cs_;}
     169             : 
     170             : private:
     171             : 
     172             :   // Local casacore::Matrix for referencing pointing pars in a convenient way
     173             :   casacore::Cube<casacore::Float>  pointPar_;
     174             :   nPBWProjectFT *pbwp_p;
     175             :   //  PBMosaicFT *pbwp_p;
     176             :   //casacore::MeasurementSet *ms_p;
     177             :   VisSet *vs_p;
     178             :   //  casacore::Array<casacore::Float> azOff, elOff;
     179             :   casacore::TempImage<casacore::Complex> targetVisModel_;
     180             :   CalSet<casacore::Float> *rcs_;
     181             :   casacore::Double maxTimePerSolution, minTimePerSolution, avgTimePerSolution;
     182             :   casacore::Timer timer;
     183             :   casacore::Vector<casacore::Int> polMap_p;
     184             :   casacore::Float tolerance_p, gain_p;
     185             :   casacore::Int niter_p;
     186             : };
     187             : 
     188             : 
     189             : 
     190             : 
     191             : 
     192             : } //# NAMESPACE CASA - END
     193             : 
     194             : #endif
     195             : 

Generated by: LCOV version 1.16