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

          Line data    Source code
       1             : //# BJonesPoly.h: A bandpass visibility Jones matrix of polynomial form
       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 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: BJonesPoly.h,v 19.9 2004/11/30 17:50:47 ddebonis Exp $
      28             : 
      29             : #ifndef SYNTHESIS_BPOLY_H
      30             : #define SYNTHESIS_BPOLY_H
      31             : 
      32             : #include <synthesis/MeasurementComponents/SolvableVisCal.h>
      33             : #include <synthesis/MeasurementComponents/StandardVisCal.h>
      34             : 
      35             : namespace casa { //# NAMESPACE CASA - BEGIN
      36             : 
      37             : // <summary> A bandpass visibility Jones matrix of polynomial form
      38             : // </summary>
      39             : 
      40             : // <use visibility=export>
      41             : 
      42             : // <reviewed reviewer="" date="" tests="" demos="">
      43             : 
      44             : // <prerequisite>
      45             : //   <li> <linkto module="BJones">BJones</linkto> module
      46             : // </prerequisite>
      47             : //
      48             : // <etymology>
      49             : // BJonesPoly describes a bandpass visibility Jones matrix of
      50             : // polynomial form.
      51             : // </etymology>
      52             : //
      53             : // <synopsis> 
      54             : //
      55             : // See <linkto class="VisEquation">VisEquation</linkto> for definition of the
      56             : // Visibility Measurement Equation.
      57             : //
      58             : // The elements of BJonesPoly are only non-zero on the diagonal.
      59             : //
      60             : // </synopsis> 
      61             : //
      62             : // <motivation>
      63             : // Support polynomial bandpass calibration.
      64             : // </motivation>
      65             : //
      66             : // <todo asof="02/02/01">
      67             : // i) Support solution intervals
      68             : // </todo>
      69             : 
      70             : class VisEquation;
      71             : class VisBuffGroupAcc;
      72             : 
      73             : class BJonesPoly : public BJones {
      74             : public:
      75             : 
      76             :   // Construct from a visibility data set
      77             :   BJonesPoly (VisSet& vs);
      78             : 
      79             :   // Construct from a MSMetaInfoForCal
      80             :   BJonesPoly (const MSMetaInfoForCal& msmc);
      81             : 
      82             :   // Destructor
      83           0 :   virtual ~BJonesPoly() {};
      84             : 
      85             :   // Return the type enum
      86           0 :   virtual Type type() { return VisCal::B; };
      87             : 
      88             :   // Return type name as string
      89           0 :   virtual casacore::String typeName()     { return "BPOLY"; };
      90           0 :   virtual casacore::String longTypeName() { return "B Jones Poly (bandpass)"; };
      91             : 
      92             :   // BPOLY gathers generically...
      93           0 :   virtual casacore::Bool useGenericGatherForSolve() { return true; };
      94             :   // ...then solves for itself per solution:
      95           0 :   virtual casacore::Bool useGenericSolveOne() { return false; };
      96             : 
      97             :   // Type of Jones matrix according to nPar()
      98           0 :   virtual Jones::JonesType jonesType() { return Jones::Diagonal; };
      99             : 
     100             :   // Set the solver parameters
     101             :   using BJones::setSolve;
     102             :   virtual void setSolve(const casacore::Record& solvepar);
     103             : 
     104             :   // Set the interpolation parameters
     105             :   using BJones::setApply;
     106             :   virtual void setApply(const casacore::Record& applypar);
     107             : 
     108             :   // Solve 
     109             :   //   (old self-directed gather and solve)
     110             :   //  virtual void selfGatherAndSolve(VisSet& vs, VisEquation& ve);
     111             :   //   (new per-solution self-solving inside generic gather)
     112             :   virtual void selfSolveOne(VisBuffGroupAcc& vbga);
     113             : 
     114             : 
     115             : protected:
     116             : 
     117             :   // BPOLY has two trivial casacore::Complex parameter (formed at fill)
     118           0 :   virtual casacore::Int nPar() { return 2; };
     119             : 
     120             :   // Calculate current parameters
     121             :   virtual void calcPar();
     122             : 
     123             :   virtual void loadMemCalTable (casacore::String applyTable,casacore::String field);
     124             : 
     125             : private:
     126             : 
     127             :   // The underlying VisSet
     128             :   VisSet* vs_p;
     129             : 
     130             :   // Private variables containing the solver parameters
     131             :   casacore::Int degamp_p, degphase_p;
     132             :   casacore::Bool visnorm_p;
     133             :   casacore::Int maskcenter_p;
     134             :   casacore::Float maskedge_p;
     135             : 
     136             :   // Derived solver parameters
     137             :   // Center mask half width (in channels)
     138             :   casacore::Int maskcenterHalf_p;
     139             :   // Fractional edge mask
     140             :   casacore::Float maskedgeFrac_p;
     141             : 
     142             :   // Some meta info
     143             :   casacore::Double solTimeStamp;
     144             :   casacore::Int solSpwId;
     145             :   casacore::Int solFldId;
     146             : 
     147             :   // CalDescId per spw
     148             :   casacore::Vector<casacore::Int> calDescId_p;
     149             : 
     150             :   // Determine if a given channel is masked
     151             :   casacore::Bool maskedChannel (const casacore::Int& chan, const casacore::Int& nChan);
     152             : 
     153             :   // Update the output calibration table to include the
     154             :   // current solution parameters
     155             :   void updateCalTable (const casacore::String& freqGrpName, 
     156             :                        const casacore::Vector<casacore::Int>& antennaId,
     157             :                        const casacore::Vector<casacore::String>& polyType, 
     158             :                        const casacore::Vector<casacore::Complex>& scaleFactor,
     159             :                        const casacore::Matrix<casacore::Double>& validDomain,
     160             :                        const casacore::Matrix<casacore::Double>& polyCoeffAmp,
     161             :                        const casacore::Matrix<casacore::Double>& polyCoeffPhase,
     162             :                        const casacore::Vector<casacore::String>& phaseUnits,
     163             :                        const casacore::Vector<casacore::Complex>& sideBandRef,
     164             :                        const casacore::Vector<casacore::MFrequency>& refFreq, 
     165             :                        const casacore::Vector<casacore::Int>& refAnt);
     166             : 
     167             :   // Compute a casacore::Chebyshev polynomial using the CLIC library
     168             :   casacore::Double getChebVal (const casacore::Vector<casacore::Double>& coeff, const casacore::Double& xinit,
     169             :                      const casacore::Double& xfinal, const casacore::Double& x);
     170             : 
     171             :   // Load bandpass parameters from a calibration table and
     172             :   // pre-compute the corrections (and their inverse)
     173             :   //  void load (const casacore::String& applyTable);
     174             : 
     175             :   // Utility function to return the bandwidth-weighted average 
     176             :   // frequency for a set of spectral window id.'s
     177             :   casacore::Double meanFrequency (const casacore::Vector<casacore::Int>& spwids);
     178             : 
     179             :   // Utility function to return the frequency group name for a given spw. id.
     180             :   casacore::String freqGrpName (const casacore::Int& spwId);
     181             : 
     182             :   // Utility function to return the spw id.'s in a given freq. group
     183             :   casacore::Vector<casacore::Int> spwIdsInGroup (const casacore::String& freqGrpName);
     184             : 
     185             :   // Utility function to return the frequency axis for a given spw. id.
     186             :   casacore::Vector<casacore::Double> freqAxis (const casacore::Int& spwId);
     187             : 
     188             :   void plotsolve2(const casacore::Vector<casacore::Double>& x, 
     189             :                   const casacore::Matrix<casacore::Double>& ampdata, 
     190             :                   const casacore::Matrix<casacore::Double>& phadata, 
     191             :                   const casacore::Matrix<casacore::Double>& wtdata, 
     192             :                   const casacore::Vector<casacore::Int>& ant1idx, const casacore::Vector<casacore::Int>& ant2idx, 
     193             :                   const casacore::Vector<casacore::Double>& amperr, casacore::Matrix<casacore::Double>& ampcoeff, 
     194             :                   const casacore::Vector<casacore::Double>& phaerr, casacore::Matrix<casacore::Double>& phacoeff) ;
     195             : 
     196             : };
     197             : 
     198             : 
     199             : } //# NAMESPACE CASA - END
     200             : 
     201             : #endif

Generated by: LCOV version 1.16