LCOV - code coverage report
Current view: top level - msvis/MSVis - GroupProcessor.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 1 0.0 %
Date: 2024-10-09 13:55:54 Functions: 0 1 0.0 %

          Line data    Source code
       1             : //# GroupProcessor.h: Step through the Measurement Set by groups of VisBuffers.
       2             : //# Copyright (C) 2011
       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 addressed 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             : #ifndef MSVIS_GROUPPROCESSOR_H
      27             : #define MSVIS_GROUPPROCESSOR_H
      28             : 
      29             : #include <casacore/casa/aips.h>
      30             : //#include <casa/Containers/Stack.h>
      31             : //#include <ms/MeasurementSets/MeasurementSet.h>
      32             : //#include <msvis/MSVis/VisBuffGroup.h>
      33             : #include <msvis/MSVis/VisibilityIterator.h>
      34             : #include <msvis/MSVis/GroupWorker.h>
      35             : 
      36             : namespace casacore{
      37             : 
      38             : //class Block;
      39             : //class MeasurementSet;
      40             : }
      41             : 
      42             : namespace casa { //# NAMESPACE CASA - BEGIN
      43             : 
      44             : //# forward decl
      45             : 
      46             : // <summary>
      47             : // GroupProcessor goes through one or more MeasurementSets, feeding VisBuffGroups
      48             : // to a GroupWorker.
      49             : // </summary>
      50             : // <use visibility=export>
      51             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
      52             : // </reviewed>
      53             : // <prerequisite>
      54             : //   <li> <linkto class="VisibilityIterator">VisibilityIterator</linkto>
      55             : //   <li> <linkto class="casacore::MeasurementSet">casacore::MeasurementSet</linkto>
      56             : //   <li> <linkto class="VisBuffer">VisBuffer</linkto>
      57             : //   <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto>
      58             : //   <li> <linkto class="GroupWorker">GroupWorker</linkto>
      59             : // </prerequisite>
      60             : //
      61             : // <etymology>
      62             : // The GroupProcessor processes one VisBuffGroup after another.
      63             : // </etymology>
      64             : //
      65             : // <synopsis>
      66             : // GroupProcessor handles iteration with by groups of chunklets
      67             : // for one or more MSs.
      68             : // </synopsis>
      69             : //
      70             : // <example>
      71             : // <code>
      72             : // // VBGContinuumSubtractor is a GroupWorker.
      73             : // VBGContinuumSubtractor vbgcs(msOut_p, fitorder_p);
      74             : //
      75             : // // sort is a casacore::Block<casacore::Int> with the right columns.
      76             : // VisibilityIterator viIn(mssel_p, sort, 0.0);
      77             : //
      78             : // GroupProcessor rogp(viIn, &vbgcs);
      79             : // casacore::Bool success = rogp.go();            // Encapsulates the nested for loops.
      80             : // </code>
      81             : // </example>
      82             : //
      83             : // <motivation>
      84             : // For imaging and calibration you need to access an casacore::MS in some consistent
      85             : // order (by field, spectralwindow, time interval etc.). This class provides
      86             : // that access.  Furthermore, some calculations or applications need more than
      87             : // one VisBuffer.  For example, one might want to estimate and subtract the
      88             : // continuum from the visibilities of an casacore::MS that has a broad line completely
      89             : // spanning spw 1, but spws 0 and 2 line-free, so the spws should be combined
      90             : // (combine='spw') for the continuum estimation.
      91             : //
      92             : // It is much more efficient if the group of necessary data can be read only
      93             : // once, worked on, and then written.  The CalTable approach is more flexible
      94             : // in that a CalTable can be applied to an casacore::MS with a different number or
      95             : // arrangement of rows from the input casacore::MS, but per chunk it requires two more
      96             : // reads (the CalTable and the _output_ casacore::MS) and an extra write (the CalTable).
      97             : //
      98             : // Another goal is to encapsulate the commonly repeated boilerplate of setting
      99             : // up VisIters and VisBuffers, and then looping over chunks and then chunklets.
     100             : //
     101             : // A separate GroupProcessor is needed so the input casacore::MS can be declared const.
     102             : // </motivation>
     103             : //
     104             : // <thrown>
     105             : //    <li>
     106             : //    <li>
     107             : // </thrown>
     108             : //
     109             : // <todo asof="2011/11/07">
     110             : // ProgressMeter
     111             : // </todo>
     112             : class GroupProcessor
     113             : {
     114             : public:
     115             :   // Construct from a ROVisibilityIterator (provides the data) and a
     116             :   // pointer to a GroupWorker (does something with the data).
     117             :   //
     118             :   // vi should be set up (selection, slurping, and sort order specified) before
     119             :   // calling this, but this will call vi.originChunks() and drive the iteration.
     120             :   //
     121             :   GroupProcessor(ROVisibilityIterator& vi, GroupWorkerBase *gw,
     122             :                    casacore::Double groupInterval=0.0);
     123             : 
     124             :   // // Copy construct. This calls the assigment operator.
     125             :   // GroupProcessor(const GroupProcessor & other){
     126             :   //   vi_p = other.vi_p ? other.vi_p->clone(&(this->vi_p)) : NULL;
     127             :   // }
     128             : 
     129             :   // Assigment. Any attached VisBuffers are lost in the assign.
     130             :   // GroupProcessor & operator=(const GroupProcessor &other);
     131             :   // // Destructor
     132             :   // //virtual ~GroupProcessor() {};
     133             :   // ~GroupProcessor() {};
     134             :   
     135             :   // Members
     136             : 
     137             :   // Return and set the "timebin" for each group, in s.
     138             :   casacore::Double groupInterval() {return groupInterval_p;}
     139             :   void setGroupInterval(casacore::Double gi) {groupInterval_p = abs(gi);}
     140             : 
     141             :   // Once it's all set up, you should just have to tell it to go!
     142             :   // Returns true/false depending on whether it thinks it went all the way.
     143             :   casacore::Bool go();
     144             :   
     145             :   static casacore::String getAipsRcBase() {return "GroupProcessor";}
     146             : 
     147           0 :   void setTVIDebug(bool debug) {tvi_debug = debug;}
     148             : 
     149             : private:
     150             :   void setGroupOrigin();        // casacore::Record the beginning of a new group.
     151             :   casacore::Bool groupHasMore();          // Returns whether or not more VisBuffers
     152             :                                 // should be added to the group.
     153             : 
     154             :   // Initialized by c'tor.
     155             :   ROVisibilityIterator vi_p;
     156             :   GroupWorkerBase      *gw_p;
     157             :   casacore::Double               groupInterval_p;  // >= 0.0, in s.
     158             : 
     159             :   // Uninitialized by c'tor.
     160             :   casacore::Vector<casacore::Double> timev_p;
     161             :   casacore::Double groupStart_p;
     162             :   bool tvi_debug;
     163             : };
     164             : 
     165             : } //# NAMESPACE CASA - END
     166             : 
     167             : #endif

Generated by: LCOV version 1.16