LCOV - code coverage report
Current view: top level - msvis/MSVis - VBGContinuumSubtractor.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 2 0.0 %
Date: 2024-11-06 17:42:47 Functions: 0 2 0.0 %

          Line data    Source code
       1             : //# VBGContinuumSubtractor.h: Estimates the continuum of VisBuffGroups and
       2             : //# writes the difference to a new MS.
       3             : //# Copyright (C) 2011
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be addressed as follows:
      21             : //#        Internet email: casa-feedback@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : 
      28             : #ifndef MSVIS_VBGCONTINUUMSUBTRACTOR_H
      29             : #define MSVIS_VBGCONTINUUMSUBTRACTOR_H
      30             : 
      31             : #include <casacore/casa/aips.h>
      32             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
      33             : #include <msvis/MSVis/GroupWorker.h>
      34             : #include <msvis/MSVis/VisibilityIterator.h>
      35             : #include <msvis/MSVis/VisBufferComponents.h>
      36             : #include <map>
      37             : #include <set>
      38             : 
      39             : namespace casa { //# NAMESPACE CASA - BEGIN
      40             : 
      41             : //# forward decl
      42             : class VisBuffGroup;
      43             : 
      44             : //<summary>VBGContinuumSubtractors subtract the continuum out of VisBuffGroups</summary>
      45             : //
      46             : // <use visibility=export>
      47             : //
      48             : // <reviewed reviewer="" date="" tests="" demos="">
      49             : 
      50             : // <prerequisite>
      51             : //   <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto>
      52             : //   <li> <linkto class="VisBuffGroup">VisibilityIterator</linkto>
      53             : //   <li> <linkto class="GroupProcessor">GroupProcessor</linkto>
      54             : //   <li> <linkto class="GroupWriteToNewMS">GroupWriteToNewMS</linkto>
      55             : // </prerequisite>
      56             : //
      57             : // <etymology>
      58             : // VBGContinuumSubtractors subtract the continuum out of VisBuffGroups.
      59             : // </etymology>
      60             : //
      61             : //<synopsis>
      62             : // This estimates the continuum by fitting a low order polynomial in frequency
      63             : // for each baseline in a VisBuffGroup, and then writes those visibilities,
      64             : // with the continuum subtracted, to a different MS.  The VisBuffers in the
      65             : // VisBuffGroup do not all have to have the same spw, set of baselines, or even
      66             : // set of correlations, but output visibilities for which the continuum cannot
      67             : // be estimated will be flagged.
      68             : //</synopsis>
      69             : //
      70             : //<todo>
      71             : // <li> 
      72             : //</todo>
      73             : class VBGContinuumSubtractor : public GroupWriteToNewMS
      74             : {
      75             : public:
      76             :   // Construct an object that will write to outms after subtracting a continuum
      77             :   // estimated by fitting a polynomial of order fitorder.  It will always
      78             :   // _write_ to DATA if datacols.nelements() == 1, and write to all 3
      79             :   // otherwise.  Thus datacols.nelements() should be either 1 or 3.  Anything
      80             :   // else will result in an AipsError.  4 and 2 are right out, and FLOAT_DATA
      81             :   // isn't handled by this yet.
      82             :   //
      83             :   // invi is the input VisibilityIterator, only used directly here to get the
      84             :   // sort columns and whether or not WEIGHT_SPECTRUM and/or FLAG_CATEGORY are
      85             :   // present.
      86             :   //
      87             :   VBGContinuumSubtractor(casacore::MeasurementSet& outms,
      88             :                          casacore::MSColumns *msc,
      89             :                          const VBRemapper& remapper,
      90             :                          const ROVisibilityIterator& invi,
      91             :                          const casacore::uInt fitorder=1,
      92             :                          const casacore::MS::PredefinedColumns datacols=casacore::MS::DATA,
      93             :                          const casacore::String& fitspw="*",
      94             :                          const casacore::String& outspw="*");
      95             : 
      96             :   //// Copy construct
      97             :   //VBGContinuumSubtractor(const VBGContinuumSubtractor& other) {}
      98             : 
      99             :   // Destructor
     100             :   virtual ~VBGContinuumSubtractor();
     101             : 
     102             :   //// Assignment
     103             :   //virtual VBGContinuumSubtractor& operator=(const VBGContinuumSubtractor& gw) {}
     104             : 
     105             :   // // Returns which columns need to be prefetched for process to work.
     106             :   // virtual asyncio::PrefetchColumns *prefetchColumns() const;
     107             : 
     108             :   // This is where all the work gets done!
     109             :   virtual casacore::Bool process(VisBuffGroup& vbg);
     110             : 
     111           0 :   void setTVIDebug(bool debug) {tvi_debug = debug;}
     112           0 :   void setWantCont(bool want_cont) {want_cont_p = want_cont;}
     113             : 
     114             : private:
     115             :   // Disable null c'tor.
     116             :   VBGContinuumSubtractor();
     117             : 
     118             :   // Initialized by c'tor:
     119             : 
     120             :   // Order of the fit polynomials.
     121             :   casacore::uInt fitorder_p;
     122             :   
     123             :   // Which of DATA, MODEL_DATA, or CORRECTED_DATA to fit.
     124             :   // It will always _write_ to DATA if datacols_p.nelements() == 1, and write
     125             :   // to all 3 otherwise.  Thus datacols_p.nelements() should be either 1 or 3.
     126             :   // 4 and 2 are right out, and FLOAT_DATA isn't handled by this yet.
     127             :   casacore::MS::PredefinedColumns datacol_p;
     128             : 
     129             :   casacore::String fitspw_p;      // Line-free channels used for the fit.  Can include ;
     130             :   casacore::String outspw_p;      // Channels to write out.  Does not yet support ;.
     131             :   casacore::uInt   rowsdone_p;    // How many rows have been written so far.
     132             :   std::set<casacore::Int> outspws_p;  // Spws to write out.
     133             :   
     134             :   casacore::Bool doWS_p;                               // Is WEIGHT_SPECTRUM present?
     135             :   casacore::Bool doFC_p;                               // Is FLAG_CATEGORY present?
     136             : 
     137             :   // Not initialized by c'tor:
     138             : 
     139             :   // These cubes could be made local to process(), but I want to avoid repeated
     140             :   // c'ting and d'ting.
     141             :   casacore::Cube<casacore::Complex> coeffs_p; // casacore::Polynomial coefficients for the continuum, indexed by (corr,
     142             :                           // order, hash(ant1, ant2).
     143             :   casacore::Cube<casacore::Bool> coeffsOK_p;  // Flags on the sol'ns, indexed by (corr,
     144             :                           // order, hash(ant1, ant2).
     145             : 
     146             :   std::set<casacore::Int> appliedSpWs_p;
     147             : 
     148             :   std::map<casacore::Int, casacore::Vector<casacore::Bool>*> fitmask_p;      // spw -> a list of flags by chan
     149             : 
     150             :   bool tvi_debug;
     151             :   bool want_cont_p;
     152             : };
     153             : 
     154             : } //# NAMESPACE CASA - END
     155             : 
     156             : #endif
     157             : 

Generated by: LCOV version 1.16