LCOV - code coverage report
Current view: top level - synthesis/CalTables - CalSet.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 23 0.0 %
Date: 2024-10-10 11:40:37 Functions: 0 41 0.0 %

          Line data    Source code
       1             : //# CalSet.h: Definition for Calibration parameter cache
       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             : 
      28             : #ifndef CALTABLES_CALSET_H
      29             : #define CALTABLES_CALSET_H
      30             : #include <casacore/casa/aips.h>
      31             : #include <casacore/casa/BasicSL/Constants.h>
      32             : #include <casacore/casa/BasicSL/Complex.h>
      33             : #include <casacore/casa/Arrays.h>
      34             : #include <casacore/casa/OS/File.h>
      35             : #include <casacore/casa/Logging/LogMessage.h>
      36             : #include <casacore/casa/Logging/LogSink.h>
      37             : #include <synthesis/CalTables/CalTableDesc2.h>
      38             : #include <synthesis/CalTables/CalTable2.h>
      39             : #include <synthesis/CalTables/SolvableCalSetMCol.h>
      40             : #include <synthesis/CalTables/VisCalEnum.h>
      41             : //#include <synthesis/CalTables/BaseCalSet.h>
      42             : 
      43             : // #include <synthesis/MeasurementComponents/VisJones.h>
      44             : // #include <synthesis/MeasurementEquations/VisEquation.h>
      45             : 
      46             : namespace casa { //# NAMESPACE CASA - BEGIN
      47             : 
      48             : 
      49             : template<class T>
      50             : class CalSet 
      51             : {
      52             : public:
      53             : 
      54             :   // Null ctor does nothing
      55             :   CalSet() {};
      56             : 
      57             :   // Minimal, knows only how many potential spws
      58             :   //   (solve context)
      59             :   CalSet(const casacore::Int& nSpw);
      60             : 
      61             :   // From full shape
      62             :   CalSet(const casacore::Int& nSpw,
      63             :          const casacore::Int& nPar,
      64             :          const casacore::Vector<casacore::Int>& nChan,
      65             :          const casacore::Int& nElem,
      66             :          const casacore::Vector<casacore::Int>& nTime);
      67             : 
      68             : 
      69             :   // From existing CalTable
      70             :   //   (apply context)
      71             :   //   (for now, we will verify that filled solutions match nPar,nElem,nSpw)
      72             :   CalSet(const casacore::String& calTableName,
      73             :          const casacore::String& select,
      74             :          const casacore::Int& nSpw,
      75             :          const casacore::Int& nPar,
      76             :          const casacore::Int& nElem);
      77             : 
      78             :   // Copy
      79             :   CalSet(const CalSet& other);
      80             : 
      81             :   // Assignment
      82             :   //  virtual CalSet& operator=(const CalSet& other);
      83             : 
      84             :   // Destructor
      85             :   virtual ~CalSet();
      86             : 
      87             :   // Resize caches
      88             :   void resize(const casacore::Int& nPar,
      89             :               const casacore::Vector<casacore::Int>& nChan,
      90             :               const casacore::Int& nElem,
      91             :               const casacore::Vector<casacore::Int>& nTime);
      92             : 
      93             :   // Access to shape info:
      94           0 :   casacore::Int& nSpw() { return nSpw_; };
      95           0 :   casacore::Int& nPar() { return nPar_; };
      96             :   casacore::Vector<casacore::Int>& nChan()  { return nChan_; };
      97           0 :   casacore::Int& nChan(const casacore::Int& spw)  { return nChan_(spw); };
      98           0 :   casacore::Int& nElem()  { return nElem_; };
      99           0 :   casacore::Vector<casacore::Int>& nTime()  { return nTime_; };
     100           0 :   casacore::Int& nTime(const casacore::Int& spw) { return nTime_(spw); };
     101             : 
     102             :   //  casacore::IPosition& shape(const casacore::Int& spw) { return casacore::IPosition(4,nPar(),nChan(spw),nElem(),nTime(spw)); };
     103             :   casacore::IPosition shape(const casacore::Int& spw) { return casacore::IPosition(4,nPar_,nChan_(spw),nElem_,nTime_(spw)); };
     104             : 
     105             :   // Set up spwOK according to solution availability
     106           0 :   inline void setSpwOK() { spwOK_ = (nTime()!=0); };
     107             : 
     108             :   // Report if solutions available for specified spw
     109           0 :   casacore::Vector<casacore::Bool> spwOK() { return spwOK_; };
     110             : 
     111             :   // Freq list per spw
     112           0 :   casacore::Vector<casacore::Double>& frequencies(const casacore::Int& spw) { return *freq_[spw]; };
     113             : 
     114             :   // Temporary method to support current conventions in SVJ
     115           0 :   void setStartChan(const casacore::Vector<casacore::Int>& startChan) {startChan_ = startChan;};
     116             :   casacore::Vector<casacore::Int>& startChan() {return startChan_;};
     117             : 
     118             :   // Access to whole solution caches 
     119           0 :   casacore::Vector<casacore::Double>& startTime(const casacore::Int& spw)    { return *MJDStart_[spw]; };
     120           0 :   casacore::Vector<casacore::Double>& stopTime(const casacore::Int& spw)     { return *MJDStop_[spw]; };
     121           0 :   casacore::Vector<casacore::Double>& time(const casacore::Int& spw)         { return *MJDTimeStamp_[spw]; };
     122           0 :   casacore::Vector<casacore::Int>&    fieldId(const casacore::Int& spw)      { return *fieldId_[spw]; };
     123             :   casacore::Vector<casacore::String>& fieldName(const casacore::Int& spw)    { return *fieldName_[spw]; };
     124             :   casacore::Vector<casacore::String>& sourceName(const casacore::Int& spw)   { return *sourceName_[spw]; };
     125           0 :   casacore::Array<T>&       par(const casacore::Int& spw)          { return *par_[spw]; };
     126           0 :   casacore::Array<casacore::Bool>&    parOK(const casacore::Int& spw)        { return *parOK_[spw]; };
     127           0 :   casacore::Array<casacore::Float>&   parErr(const casacore::Int& spw)       { return *parErr_[spw]; };
     128           0 :   casacore::Array<casacore::Float>&   parSNR(const casacore::Int& spw)       { return *parSNR_[spw]; };
     129             : 
     130             :   // Statistics
     131             :   //  casacore::Matrix<casacore::Bool>&   iSolutionOK(const casacore::Int& spw)  { return *iSolutionOK_[spw]; };
     132           0 :   casacore::Matrix<casacore::Float>&  iFit(const casacore::Int& spw)         { return *iFit_[spw]; };
     133           0 :   casacore::Matrix<casacore::Float>&  iFitwt(const casacore::Int& spw)       { return *iFitwt_[spw]; };
     134           0 :   casacore::Vector<casacore::Bool>&   solutionOK(const casacore::Int& spw)   { return *solutionOK_[spw]; };
     135           0 :   casacore::Vector<casacore::Float>&  fit(const casacore::Int& spw)          { return *fit_[spw]; };
     136           0 :   casacore::Vector<casacore::Float>&  fitwt(const casacore::Int& spw)        { return *fitwt_[spw]; };
     137             : 
     138             :   // Store/Retrieve solutions to/from a table.
     139             :   //  (will evolve to use table iteration)
     140             :   virtual void initCalTableDesc(const casacore::String& type, const casacore::Int& parType);
     141             :   virtual void attach();
     142             :   virtual void store(const casacore::String& file, const casacore::String& type, const casacore::Bool& append,
     143             :                      const casacore::String& msname="");
     144             : //   virtual void store(const casacore::String& file, const casacore::String& type, 
     145             : //                   const casacore::String& msname, const casacore::Bool& append);
     146             :   virtual void load(const casacore::String& file, const casacore::String& select);
     147             : 
     148             : protected:
     149             : 
     150             : 
     151             : private:
     152             : 
     153             :   // new/delete of cache
     154             :   void inflate();
     155             :   void deflate();
     156             : 
     157             : 
     158             :   // casacore::Table name
     159             :   casacore::String calTableName_;
     160             : 
     161             :   // Number of Spectral windows
     162             :   casacore::Int nSpw_;
     163             : 
     164             :   // Number of parameters describing this calibration component
     165             :   casacore::Int nPar_;
     166             : 
     167             :   // Number of channels
     168             :   casacore::Vector<casacore::Int> nChan_;          // (nSpw_) number of _soln_ channels per spw
     169             : 
     170             :   // Number of elements (ants or baselines)
     171             :   casacore::Int nElem_;
     172             : 
     173             :   // Number of time slots
     174             :   casacore::Vector<casacore::Int> nTime_;         // (nSpw_) number of slots per spw
     175             : 
     176             :   // Spw OK?
     177             :   casacore::Vector<casacore::Bool> spwOK_;
     178             : 
     179             :   // Channel frequencies, etc.
     180             :   casacore::Vector<casacore::Int> startChan_;            // (nSpw_) start data channel per spw
     181             :   casacore::PtrBlock<casacore::Vector<casacore::Double>*> freq_;   // [nSpw_](nChan_)
     182             : 
     183             :   // Per spw, per slot Meta information
     184             :   casacore::PtrBlock<casacore::Vector<casacore::Double>*> MJDStart_;       // (nSpw_)(numberSlots_)
     185             :   casacore::PtrBlock<casacore::Vector<casacore::Double>*> MJDStop_;        // (nSpw_)(numberSlots_)
     186             :   casacore::PtrBlock<casacore::Vector<casacore::Double>*> MJDTimeStamp_;   // (nSpw_)(numberSlots_)
     187             :   casacore::PtrBlock<casacore::Vector<casacore::Int>*>    fieldId_;        // (nSpw_)(numberSlots_)
     188             :   casacore::PtrBlock<casacore::Vector<casacore::String>*> fieldName_;      // (nSpw_)(numberSlots_)
     189             :   casacore::PtrBlock<casacore::Vector<casacore::String>*> sourceName_;     // (nSpw_)(numberSlots_)
     190             : 
     191             :   // Per spw, per channel, per element, per slot solution generic PARAMETER storage  
     192             :   casacore::PtrBlock<casacore::Array<T>*>      par_;    // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
     193             :   casacore::PtrBlock<casacore::Array<casacore::Bool>*>   parOK_;  // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
     194             :   casacore::PtrBlock<casacore::Array<casacore::Float>*>  parErr_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
     195             :   casacore::PtrBlock<casacore::Array<casacore::Float>*>  parSNR_; // (nSpw_)(nPar_,nSolnChan_,nElem_,numberSlots_)
     196             : 
     197             :   // Statistics
     198             :   //  casacore::PtrBlock<casacore::Matrix<casacore::Bool>*> iSolutionOK_;  // [nSpw_](nElem_,nSlots_)
     199             :   casacore::PtrBlock<casacore::Matrix<casacore::Float>*> iFit_;        // [nSpw_](nElem_,nSlots_)
     200             :   casacore::PtrBlock<casacore::Matrix<casacore::Float>*> iFitwt_;      // [nSpw_](nElem_,nSlots_)
     201             : 
     202             :   casacore::PtrBlock<casacore::Vector<casacore::Bool>*> solutionOK_;   // [nSpw_](numberSlots_)
     203             :   casacore::PtrBlock<casacore::Vector<casacore::Float>*> fit_;         // [nSpw_](numberSlots_)
     204             :   casacore::PtrBlock<casacore::Vector<casacore::Float>*> fitwt_;       // [nSpw_](numberSlots_)
     205             : 
     206             :   casacore::LogSink logSink_p;
     207             :   casacore::LogSink& logSink() {return logSink_p;};
     208             : 
     209             :   CalTableDesc2 *calTabDesc_;
     210             :   CalTable2 *calTab_;
     211             :   SolvableCalSetMCol<T> *svjmcol_;
     212             : 
     213             : };
     214             : 
     215             : // Globals
     216             : 
     217             : // casacore::Smooth the solutions in a CalSet
     218             :   void smooth(CalSet<casacore::Complex>& cs,
     219             :               const casacore::String& smtype,
     220             :               const casacore::Double& smtime,
     221             :               casacore::Vector<casacore::Int> selfields);
     222             : 
     223             : } //# NAMESPACE CASA - END
     224             : 
     225             : #ifndef AIPS_NO_TEMPLATE_SRC
     226             : #include <synthesis/CalTables/CalSet.tcc>
     227             : #endif
     228             : 
     229             : #endif

Generated by: LCOV version 1.16