LCOV - code coverage report
Current view: top level - msvis/MSVis - VisBuffGroupAcc.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 4 0.0 %
Date: 2024-10-10 19:51:30 Functions: 0 4 0.0 %

          Line data    Source code
       1             : //# VisBuffGroupAcc.h: class to group separately averaged VisBuffers
       2             : //# Copyright (C) 2008
       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             : //# $Id: VisBuffAccumulator.h,v 19.6 2004/11/30 17:50:38 ddebonis Exp $
      27             : 
      28             : #ifndef MSVIS_VISBUFFGROUPACC_H
      29             : #define MSVIS_VISBUFFGROUPACC_H
      30             : 
      31             : #include <casacore/casa/aips.h>
      32             : #include <msvis/MSVis/VisBuffAccumulator.h>
      33             : #include <map>
      34             : 
      35             : namespace casa { //# NAMESPACE CASA - BEGIN
      36             : 
      37             : // <summary>
      38             : // A class to group separately averaged VisBuffers 
      39             : // </summary>
      40             : //
      41             : // <use visibility=export>
      42             : //
      43             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
      44             : // </reviewed>
      45             : 
      46             : // <prerequisite>
      47             : //   <li> VisBufferAccumulator
      48             : // </prerequisite>
      49             : //
      50             : // <etymology>
      51             : // 
      52             : // </etymology>
      53             : //
      54             : // <synopsis>
      55             : // This class groups separately averaged VisBuffers
      56             : // </synopsis>
      57             : //
      58             : // <example>
      59             : // </example>
      60             : //
      61             : // <motivation>
      62             : // To encapsulate in a single object multiple (averaged) VisBuffers
      63             : // for the solver.
      64             : //
      65             : // Used by calibration to generate multiple accumulations, e.g., per spw, when
      66             : // using combine='spw' and the data cannot be averaged over spw.
      67             : // </motivation>
      68             : //
      69             : // <thrown>
      70             : //    <li>
      71             : //    <li>
      72             : // </thrown>
      73             : //
      74             : // <todo asof="2008/08/04">
      75             : //   <li> ??
      76             : // </todo>
      77             : 
      78             : class VisBuffGroupAcc
      79             : {
      80             : public:
      81             :   // Construct from the number of antennas, spws, fields, the averaging interval and the pre-normalization flag
      82             :   VisBuffGroupAcc (const casacore::Int& nAnt, 
      83             :                    const casacore::Int& nSpw, 
      84             :                    const casacore::Int& nFld,
      85             :                    const casacore::Double& subinterval,
      86             :                    const casacore::Bool fillModel=true);
      87             : 
      88             :   // Null destructor
      89             :   ~VisBuffGroupAcc();
      90             : 
      91             :   // Accumulate a VisBuffer
      92             :   void accumulate (const VisBuffer& vb);
      93             : 
      94             :   // Finalize averaging, and return the result
      95             :   void finalizeAverage();
      96             : 
      97             :   // Make data amp- or phase-only
      98             :   void enforceAPonData(const casacore::String& apmode);
      99             : 
     100             :   // Optionally set cross-hands weights to zero, so they are 
     101             :   //   not used (e.g., for solving) subsequently, but remain
     102             :   //   present in case a general calibration (like P for linears)
     103             :   //   is applied that will mix them with the parallel hands
     104             :   void enforceSolveCorrWeights(const casacore::Bool phandonly=false);
     105             : 
     106             :   // How many separate VisBuffers are contained herein?
     107           0 :   casacore::Int nBuf() const {return nBuf_p;}
     108             : 
     109           0 :   casacore::Int nAnt() const {return nAnt_p;}
     110             :   casacore::Int nSpw() const {return nSpw_p;}
     111             :   casacore::Int nFld() const {return nFld_p;}
     112             : 
     113             :   // The global timestamp
     114           0 :   casacore::Double& globalTimeStamp() { return globalTimeStamp_p; };
     115             : 
     116             :   // Return reference to the indexed VisBuffer
     117             :   CalVisBuffer& operator()(const casacore::Int& buf);
     118             :   CalVisBuffer& operator()(const casacore::Int& spw, const casacore::Int& fld);
     119             : 
     120             :   // Return a map from row numbers in the VisBuffer returned by the above
     121             :   // operator()s to row numbers in the corresponding input VisBuffer.  Only
     122             :   // useful if there is exactly one corresponding input VisBuffer or you are
     123             :   // sure that the last corresponding input VisBuffer will meet your
     124             :   // needs (i.e. all the corresponding input VisBuffers had same set of
     125             :   // antennas and the metadata you want also matches).  hurl controls whether
     126             :   // an exception will be thrown if the number of VisBuffers that went into the
     127             :   // output of operator() != 1.  Unfilled rows point to -1.
     128             :   const casacore::Vector<casacore::Int>& outToInRow(const casacore::Int buf, const casacore::Bool hurl=true) const;
     129             :   const casacore::Vector<casacore::Int>& outToInRow(const casacore::Int spw, const casacore::Int fld,
     130             :                                 const casacore::Bool hurl=true) const;
     131             : 
     132             :   // Setup chanmask from a spw:chan selection string and an MS.
     133             :   // static so a chanmask can be made once and provided to multiple VBGAs.
     134             :   static casacore::Bool fillChanMask(std::map<casacore::Int, casacore::Vector<casacore::Bool>*>& chanmask,
     135             :                            const casacore::String& spwstr,
     136             :                            const casacore::MeasurementSet& ms);
     137             : 
     138             :   // Select channels in the accumulated buffers by flagging with the chanmask.
     139             :   // Returns the number of VisBuffers that the chanmask operated on.
     140             :   casacore::uInt applyChanMask(std::map<casacore::Int, casacore::Vector<casacore::Bool>*>& chanmask);
     141             : 
     142             :   // Empties chanmask (which may have some newed elements).
     143             :   static void clearChanMask(std::map<casacore::Int, casacore::Vector<casacore::Bool>*>& chanmask);
     144             : 
     145           0 :   void setTVIDebug(bool debug) {tvi_debug = debug;}
     146             : 
     147             :   void reportData();
     148             : 
     149             : private:
     150             : 
     151             :   // Prohibit in-public null constructor, copy constructor and assignment
     152             :   VisBuffGroupAcc();
     153             :   VisBuffGroupAcc& operator= (const VisBuffGroupAcc&);
     154             :   VisBuffGroupAcc (const VisBuffGroupAcc&);
     155             : 
     156             :   // Number of antennas, spw, fld, buffers
     157             :   casacore::Int nAnt_p, nSpw_p, nFld_p, nBuf_p;
     158             : 
     159             :   // Averaging interval
     160             :   casacore::Double subinterval_p;
     161             : 
     162             :   casacore::Bool fillModel_p;     // Whether or not to accumulate MODEL_DATA  
     163             : 
     164             :   // Pre-normalization flag
     165             :   casacore::Bool prenorm_p;
     166             : 
     167             :   // Per-interval timestamp averaging
     168             :   casacore::Double globalTimeStamp_p;
     169             : 
     170             :   // Averaging buffer  (length = nSpw_p x nFld_p)
     171             :   casacore::PtrBlock<VisBuffAccumulator*> VBA_p;
     172             :   
     173             :   // casacore::Map spw,fld to the buffer id
     174             :   casacore::Matrix<casacore::Int> spwfldids_p;
     175             : 
     176             :   bool tvi_debug;
     177             : };
     178             : 
     179             : 
     180             : } //# NAMESPACE CASA - END
     181             : 
     182             : #endif
     183             : 
     184             : 

Generated by: LCOV version 1.16