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

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

Generated by: LCOV version 1.16