LCOV - code coverage report
Current view: top level - msvis/MSVis - VisBuffer2.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 2 5 40.0 %
Date: 2024-10-04 16:51:10 Functions: 2 6 33.3 %

          Line data    Source code
       1             : //# VisBuffer.h: buffer for iterating through casacore::MS in large blocks
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,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 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             : 
      27             : #ifndef MSVIS_VISBUFFER2_H
      28             : #define MSVIS_VISBUFFER2_H
      29             : 
      30             : #include <casacore/casa/aips.h>
      31             : 
      32             : //#include <casa/Arrays/Cube.h>
      33             : //#include <casa/Arrays/Vector.h>
      34             : //#include <casa/Arrays/Matrix.h>
      35             : //#include <casa/BasicSL/Complex.h>
      36             : #include <casacore/casa/BasicSL/Complexfwd.h>
      37             : #include <msvis/MSVis/VisBufferComponents2.h>
      38             : //#include <msvis/MSVis/VisibilityIterator2.h>
      39             : #include <casacore/measures/Measures/Stokes.h>
      40             : #include <casacore/casa/Arrays/ArrayFwd.h>
      41             : #include <casacore/casa/Exceptions/Error.h>
      42             : #include <casacore/tables/Tables/RowNumbers.h>
      43             : 
      44             : using casa::vi::VisBufferComponent2;
      45             : using casa::vi::VisBufferComponents2;
      46             : 
      47             : namespace casacore{
      48             : 
      49             : template <typename T> class CountedPtr;
      50             : class MDirection;
      51             : template <typename T, Int N> class SquareMatrix;
      52             : class MeasurementSet;
      53             : }
      54             : 
      55             : namespace casa { //# NAMESPACE CASA - BEGIN
      56             : 
      57             : //#forward
      58             : 
      59             : class CStokesVector;
      60             : 
      61             : namespace ms {
      62             : 
      63             :     class MsRow;
      64             : }
      65             : 
      66             : namespace vi {
      67             : 
      68             : class Subchunk;
      69             : class ViImplementation2;
      70             : class VisibilityIterator2;
      71             : class WeightScaling;
      72             : class SubtableColumns;
      73             : 
      74             : // These are options to be applied to a VisBuffer, usually when it's created.
      75             : // The intent is that these form a bit mask so that they can be used as
      76             : // VbWritable | VbRekeyable, etc.  So add the next one in as 2 * theLastOne.
      77             : 
      78             : enum VisBufferOptions : int {VbNoOptions, VbWritable = 1, VbRekeyable = 2};
      79             : 
      80             : //<summary>VisBuffer2s encapsulate one chunk of visibility data for processing.</summary>
      81             : //
      82             : // <use visibility=export>
      83             : //
      84             : // <reviewed reviewer="" date="" tests="" demos="">
      85             : 
      86             : // <prerequisite>
      87             : //   <li> <linkto class="VisibilityIterator">VisibilityIterator</linkto>
      88             : //   <li> <linkto class="VbDirtyComponents">VbDirtyComponents</linkto>
      89             : // </prerequisite>
      90             : //
      91             : // <etymology>
      92             : // VisBuffer2 is a buffer for visibility data
      93             : // </etymology>
      94             : //
      95             : //<synopsis>
      96             : // The VisBuffer is designed to contain a small amount of visibility-related
      97             : // data.  The VisBuffer can be used in two somewhat distinct ways.  The first
      98             : // is as an integral (or attached) part of the VisibilityIterator and the second
      99             : // is as a free or unattached object.
     100             : //
     101             : // Attached VisBuffer -- Each VisibilityIterator has a exactly one VisBuffer
     102             : // attached to it.  This VisBuffer is created and destroyed by the
     103             : // VisibilityIterator.  The role of an attached VB is to contain the data
     104             : // currently "pointed to" by the VI.  Because of this tight coupling between
     105             : // an attached VI and its VB the operations that can be applied to a VisBuffer
     106             : // are somewhat restricted in order to maintain the relationship between the
     107             : // casacore::MeasurementSet's data and the data i the VisBuffer (failure to do so allows
     108             : // obscure bugs to be created).  As such the functions for averaging in either
     109             : // the time or frequency axes is not permitted on an attached VB.
     110             : //
     111             : // Free VisBuffer -- A free VisBuffer is used to contain data that might not
     112             : // correspond to the data in the MeasurementSet.  The meaning of the data in
     113             : // a free VisBuffer will depend on the user.  Some obvious examples might be:
     114             : // a VisBuffer used to resample or average frequencies together; creation of
     115             : // "virtual" spectral windows which might reconnect frequencies that were
     116             : // split into separate spectral windows becasue of hardware limitation; and
     117             : // performing a time average of visibility data.  Because the free VB is not
     118             : // tightly coupled to a VI, it is the responsibility of the user to assign
     119             : // meaningful values to some of the fields in the VB.  For example, the user
     120             : // averaging across time will need to decide what values ought to be reported
     121             : // for the VisBuffer's timestamp, pointing angle, etc.
     122             : //
     123             : // Another possible attribute of a VisBuffer is "rekeyable".  This is for when
     124             : // the VisBuffer is being filled by client code rather than from an input MS.
     125             : // Because of this, the enforcement of VisBuffer invariants is relaxed.  Users
     126             : // will be able to change row key fields (e.g., antenna1, data description id,
     127             : // etc.) as well as change the shape of the data.  The method validateShapes is
     128             : // provided which will check that all modified shapes are consistent.  This method
     129             : // is automatically called by writeChangesBack and should also be called whenever
     130             : // the construction process is complete and the VisBuffer is about to be released
     131             : // for use; it's better to catch the error rather than letting an inconsistent
     132             : // VisBuffer escape into consuming code.
     133             : //
     134             : //</synopsis>
     135             : //
     136             : //<todo>
     137             : //</todo>
     138             : 
     139             : class VisBuffer2 {
     140             : 
     141             :     friend class ViImplementation2;
     142             :     friend class VisibilityIteratorImpl2;
     143             :     friend class FinalTvi2;
     144             :     friend class TransformingVi2;
     145             :     friend class SimpleSimVi2;
     146             : 
     147             : public:
     148             : 
     149             :     // make noncopyable...
     150             :     VisBuffer2( const VisBuffer2& ) = delete;
     151             :     VisBuffer2& operator=( const VisBuffer2& ) = delete;
     152             : 
     153             :     enum {FrameNotSpecified = -2};
     154             : 
     155           1 :     VisBuffer2 () : associatedVi_p (nullptr) {}
     156             : 
     157             :     static VisBuffer2 * factory (VisBufferOptions vbOptions = VbNoOptions);
     158             : 
     159             :         // Used by framework
     160             : 
     161             :     // Destructor (detaches from VisIter)
     162             : 
     163           1 :     virtual ~VisBuffer2() {}
     164             : 
     165             :     virtual ms::MsRow * getRow (casacore::Int row) const;
     166             :     virtual ms::MsRow * getRowMutable (casacore::Int row);
     167             : 
     168             :     //---------------------------------------------------------------------
     169             :     //
     170             :     // Copying methods
     171             :     //
     172             :     // These methods allow copying portions of the data between two
     173             :     // VisBuffers.  Because of the complicated semantics of a VisBuffer the
     174             :     // assignment and copy-construction methods are not used as they are likely
     175             :     // to confuse VisBuffer users.
     176             : 
     177             : 
     178             :     // Copies all of the components from the specified VisBuffer into this one.
     179             :     // Uncached values will be cleared in this VB.
     180             : 
     181             :     virtual void copy (const VisBuffer2 & other, casacore::Bool fetchIfNeeded) = 0;
     182             : 
     183             :     // Copies the specified components (or just the ones in the cache if
     184             :     // fetchIfNeeded is false) from the specified VisBuffer into this one.
     185             :     // If this VB is not empty it will must have the same shape as the other
     186             :     // VB unless allowShapeChange is true; in that case this VB will change
     187             :     // changes to match the other VB flushing the cached data.
     188             : 
     189             :     virtual void copyComponents (const VisBuffer2 & other,
     190             :                                  const VisBufferComponents2 & components,
     191             :                                  casacore::Bool allowShapeChange = false,
     192             :                                  casacore::Bool fetchIfNeeded = true) = 0;
     193             : 
     194             :     // Copies the coordinate components (or just the ones in the cache if
     195             :     // fetchIfNeeded is false) from the specified VisBuffer into this one.
     196             :     // If this VB is not empty it will must have the same shape as the other
     197             :     // VB unless allowShapeChange is true; in that case this VB will change
     198             :     // changes to match the other VB flushing the cached data.
     199             :     // The basic coordinate components are:
     200             :     //  Antenna1, Antenna2, ArrayId, DataDescriptionIds, FieldId, SpectralWindows,
     201             :     //  casacore::Time, NRows, Feed1, Feed2
     202             :     // The directional coordinates (copied if includeDirections is true):
     203             :     //   Direction1, Direction2, FeedPa1, FeedPa2
     204             : 
     205             :     virtual void copyCoordinateInfo(const VisBuffer2 * other,
     206             :                                     casacore::Bool includeDirections,
     207             :                                     casacore::Bool allowShapeChange = false,
     208             :                                     casacore::Bool fetchIfNeeded = true) = 0;
     209             : 
     210             :     virtual void setShape (casacore::Int nCorrelations, casacore::Int nChannels, casacore::rownr_t nRows, casacore::Bool clearCache = false) = 0;
     211             :     virtual void validateShapes () const = 0;
     212             : 
     213             :     // For attached VBs this returns the VI the VB is attached to.  For free VBs
     214             :     // this method returns false. N.B.: Use of this method is deprecated.
     215             : 
     216             :     virtual const VisibilityIterator2 * getVi () const;
     217             : 
     218           0 :     virtual const casacore::MeasurementSet& ms() const { ThrowCc ("Should be overridden"); } // Kluge
     219           0 :     virtual const vi::SubtableColumns & subtableColumns () const { ThrowCc ("Should be overridden"); } // Kluge
     220             :         virtual casacore::Bool existsColumn (VisBufferComponent2 id) const = 0;
     221             :     
     222             :     virtual casacore::Bool isAttached () const = 0;
     223             :     virtual casacore::Bool isFillable () const = 0;
     224             : 
     225             :     //---------------------------------------------------------------------
     226             :     //
     227             :     //    Dirty component methods
     228             :     //
     229             :     //    The dirtyComponent methods support the data-flow approach to using
     230             :     //    VisBuffers (the Visibility Processing Framework).  In this approach
     231             :     //    a VisBuffer is passed to successive processing nodes (e.g., applycal,
     232             :     //    flagging, etc.) which operate  on it and pass it on to the next node
     233             :     //    in the algorithm. The dirtyComponents mechanism allows a processing
     234             :     //    node to mark portions of the VisBuffer as modified.  If the VisBuffer
     235             :     //    reaches an write-to-disk node then the modified portions of the
     236             :     //    VisBuffer will be written out.  The user can also explicitly direct
     237             :     //    that the changes be written out using the writeChangesBack method.
     238             :     //
     239             :     //    Using a setter on a VisBuffer component will also set the dirty flag for
     240             :     //    that component.  Normally the user should not need to use these methods;
     241             :     //    however, they are available in case unexpected situations should arise
     242             :     //    in the future.
     243             : 
     244             :     virtual void writeChangesBack () = 0;
     245             :     virtual void initWeightSpectrum (const casacore::Cube<casacore::Float>& wtspec) = 0;
     246             :     virtual void initSigmaSpectrum (const casacore::Cube<casacore::Float>& sigspec) = 0;
     247             : 
     248             :     virtual void dirtyComponentsAdd (const VisBufferComponents2 & additionalDirtyComponents) = 0;
     249             :     virtual void dirtyComponentsAdd (VisBufferComponent2 component) = 0;
     250             :     virtual void dirtyComponentsClear () = 0;
     251             :     virtual VisBufferComponents2 dirtyComponentsGet () const = 0;
     252             :     virtual void dirtyComponentsSet (const VisBufferComponents2 & dirtyComponents) = 0;
     253             :     virtual void dirtyComponentsSet (VisBufferComponent2 component) = 0;
     254             : 
     255             :     // This method returns the imagin g
     256             :     // If an imaging weight generator has not been supplied to the associated
     257             :     // VisibilityIterator then this method will throw an exception.
     258             : 
     259             :     virtual const casacore::Matrix<casacore::Float> & imagingWeight() const = 0;
     260             :     virtual void setImagingWeight (const casacore::Matrix<casacore::Float> & newImagingWeights) = 0;
     261             : 
     262             :     //---------------------------------------------------------------------------
     263             :     //
     264             :     // Frequency reporting methods.
     265             :     //
     266             :     // These methods provide information about the frequencies returned in the
     267             :     // visibility cubes.  The information can returned as the channel numbers
     268             :     // (numbered as in the underlying casacore::MS data) or in a frame-based frequency.
     269             :     // This information reported need not be in the same frame of reference
     270             :     // used to select the data.  If the frame of reference is specified in the
     271             :     // call, then that is the frame that is used to calculate the frequencies.
     272             :     // If it is not specified, then the VisibilityIterator will be queried for
     273             :     // virtual the reportingFrame = 0; if the user has specified a reporting frame to the
     274             :     // virtual VI then that frame will be used = 0; otherwise the frame used to select
     275             :     // the frequencies will be used.  If the user provides no frequency selection
     276             :     // to the VI then the selection frame will TOPO.
     277             :     //
     278             :     // Both the channelNumber and frequency reporting methods come in two versions:
     279             :     // one returns a single frequency for the specified frequency index and row
     280             :     // while the other provides all of the frequencies for the specified row.
     281             :     // The frequency index is the zero-based index along the frequency axis of
     282             :     // a visibility cube.
     283             : 
     284             :     virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesDefined () const = 0;
     285             :     virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesSelected () const = 0;
     286             :     virtual casacore::Vector<casacore::Int> getCorrelationTypes () const = 0;
     287             :     virtual casacore::Double getFrequency (casacore::Int rowInBuffer, casacore::Int frequencyIndex,
     288             :                                  casacore::Int frame = FrameNotSpecified) const = 0;
     289             :     virtual const casacore::Vector<casacore::Double> & getFrequencies (casacore::Int rowInBuffer,
     290             :                                                    casacore::Int frame = FrameNotSpecified) const = 0;
     291             :     virtual casacore::Int getChannelNumber (casacore::Int rowInBuffer, casacore::Int frequencyIndex) const = 0;
     292             :     virtual const casacore::Vector<casacore::Int> & getChannelNumbers (casacore::Int rowInBuffer) const = 0;
     293             :     virtual casacore::Vector<casacore::Int> getChannelNumbersSelected (casacore::Int outputChannelIndex) const = 0;
     294             : 
     295             :     // casacore::Sort/unsort the correlations, if necessary
     296             :     //  (Rudimentary handling of non-canonically sorted correlations--use with care!)
     297             :     //
     298             :     // The sorting functionality is a horrible kluge that puts the VisBuffer into a
     299             :     // somewhat incoherent state (e.g., after sorting the correlation types array
     300             :     // does not correspond to the data) and appears to serve the needs
     301             :     // of a tiny piece of code.  As such, this refactor is initially not going to
     302             :     // support this functionality since it is probably better implemented in the one
     303             :     // place that actually needs it. (jjacobs 10/3/12)
     304             :     //
     305             :     //virtual void sortCorr () = 0;
     306             :     //virtual void unSortCorr() = 0;
     307             : 
     308             :     // Normalize the visCube by the modelVisCube.
     309             : 
     310             :     virtual void normalize() = 0;
     311             : 
     312             :     // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
     313             :     virtual void phaseCenterShift(const casacore::Vector<casacore::Double>& phase) = 0;
     314             :     // Rotate visibility phase for phase center offsets (arcsecs)
     315             :     virtual void phaseCenterShift(casacore::Double dx, casacore::Double dy) = 0;
     316             : 
     317             :     // Set the weight cube using the sigma cube.  Each weight will be
     318             :     // the reciprocal of the square of the corresponding element in the model
     319             :     // VisCube multiplied by the number of channels in the spectral window.
     320             :     // If an element in sigma is zero then the corresponding weight element
     321             :     // will also be set to zero.
     322             : 
     323             :     virtual void resetWeightsUsingSigma () = 0;//void resetWeightMat() = 0;
     324             : 
     325             :     //----------------------------------------------------------------------
     326             :     //
     327             :     //  Subhchunk information methods
     328             :     //
     329             :     //  These methods provide information related to the current subchunk.
     330             :     //  The isNewXXX methods return true if the XXX property of the subchunk
     331             :     //  differs from the previous subchunk.
     332             :     //
     333             :     //  The methods msId and msName provide information about the MS
     334             :     //  related to the current subchunk.  The msID is the zero-based index
     335             :     //  of the casacore::MS in the sequence of MSs being iterated over.
     336             :     //
     337             :     //  The isWritable method is true when the attached iterator is writable
     338             :     //  and false otherwise.
     339             :     //
     340             :     //  The isRekeyable method is true when the VisBuffer is writable and also
     341             :     //  allows the modification of non-data fields (e.g., antenna1, fieldId, etc.)
     342             :     //  A rekeyable VB is one that could be used to create data for a brand new
     343             :     //  MS.
     344             : 
     345             :     virtual casacore::Bool isNewArrayId () const = 0;
     346             :     virtual casacore::Bool isNewFieldId () const = 0;
     347             :     virtual casacore::Bool isNewMs() const = 0;
     348             :     virtual casacore::Bool isNewSpectralWindow () const = 0;
     349             :     virtual casacore::Bool isWritable () const = 0;
     350             :     virtual casacore::Int msId() const /*__attribute__((deprecated))*/ = 0;
     351             :     virtual casacore::String msName (casacore::Bool stripPath = false) const /*__attribute__((deprecated))*/ = 0;
     352             :     virtual Subchunk getSubchunk () const = 0;
     353             : 
     354             :     //////////////////////////////////////////////////////////////////////
     355             :     //
     356             :     //  casacore::Data accessors and setters (where appropriate)
     357             :     //
     358             :     //  There are the methods that allows access to the items cached in the
     359             :     //  VisBuffer.  The straight accessors provide read-only access to the
     360             :     //  item.  Where the item is allowed to be modified, one or more set
     361             :     //  methods are provided.
     362             :     //
     363             :     //  The dimensionality of the major object in in accessor/setter is
     364             :     //  shown in a trailing comment using the following abbreviations:
     365             :     //
     366             :     //  nA :== number of antennas
     367             :     //  nF :== number of frequencies (or channels)
     368             :     //  nC :== number of correlations
     369             :     //  nR :== number of table rows contained in the buffer
     370             : 
     371             :     //--------------------------------------------------------
     372             :     //
     373             :     // Accessors for data contained in the main casacore::MeasurementSet main table
     374             :     // The actual visibility data are at the end.
     375             :     //
     376             :     //  *** N.B.: the VB usually caches the information
     377             :     //  in the representation requested so that using a setter to modify
     378             :     //  one value type (e.g., weight or visibility) will not modify the
     379             :     //  cached value in a different representation (e.g., weightMat or
     380             :     //  visCube).  This should not be a problem in normal usage.
     381             : 
     382             :     virtual const casacore::Vector<casacore::Int> & antenna1 () const = 0; // [nR]
     383             :     virtual void setAntenna1 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     384             :     virtual const casacore::Vector<casacore::Int> & antenna2 () const = 0; // [nR]
     385             :     virtual void setAntenna2 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     386             :     virtual const casacore::Vector<casacore::Int> & arrayId () const = 0;
     387             :     virtual void setArrayId (const casacore::Vector<casacore::Int> & ) = 0;
     388             :     //virtual casacore::Int dataDescriptionId () const = 0;
     389             :     //virtual void setDataDescriptionId (casacore::Int value) = 0;
     390             :     virtual const casacore::Vector<casacore::Int> & dataDescriptionIds () const = 0; // [nR]
     391             :     virtual void setDataDescriptionIds (const casacore::Vector<casacore::Int> & ) = 0; // [nR]
     392             :     virtual const casacore::Vector<casacore::MDirection> & direction1 () const = 0; // [nR]
     393             :     virtual const casacore::Vector<casacore::MDirection> & direction2 () const = 0; // [nR]
     394             :     virtual const casacore::Vector<casacore::Double> & exposure () const = 0; // [nR]
     395             :     virtual void setExposure (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
     396             :     virtual const casacore::Vector<casacore::Int> & feed1 () const = 0; // [nR]
     397             :     virtual void setFeed1 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     398             :     virtual const casacore::Vector<casacore::Int> & feed2 () const = 0; // [nR]
     399             :     virtual void setFeed2 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     400             :     virtual const casacore::Vector<casacore::Int> & fieldId () const = 0;
     401             :     virtual void setFieldId (const casacore::Vector<casacore::Int> &) = 0;
     402             :     //virtual const casacore::Matrix<casacore::Bool> & flag () const = 0; // [nF,nR]
     403             :     //virtual void setFlag (const casacore::Matrix<casacore::Bool>& value) = 0; // [nF,nR]
     404             :     virtual const casacore::Array<casacore::Bool> & flagCategory () const = 0; // [nC,nF,nCategories,nR]
     405             :     virtual void setFlagCategory (const casacore::Array<casacore::Bool>& value) = 0; // [nC,nF,nCategories,nR]
     406             :     virtual const casacore::Vector<casacore::Array<casacore::Bool>> & flagCategories () const = 0; // [nC,nF,nCategories,nR]
     407             :     virtual void setFlagCategories (const casacore::Vector<casacore::Array<casacore::Bool>>& value) = 0; // [nC,nF,nCategories,nR]
     408             :     virtual const casacore::Cube<casacore::Bool> & flagCube () const = 0; // [nC,nF,nR]
     409             :     virtual void setFlagCube (const casacore::Cube<casacore::Bool>& value) = 0; // [nC,nF,nR]
     410             :     virtual const casacore::Vector<casacore::Cube<casacore::Bool>> & flagCubes () const = 0; // [nC,nF,nR]
     411             :     virtual void setFlagCubes (const casacore::Vector<casacore::Cube<casacore::Bool>>& value) = 0; // [nC,nF,nR]
     412             :     virtual const casacore::Vector<casacore::Bool> & flagRow () const = 0; // [nR]
     413             :     virtual void setFlagRow (const casacore::Vector<casacore::Bool>& value) = 0; // [nR]
     414             :     virtual const casacore::Vector<casacore::Int> & observationId () const = 0; // [nR]
     415             :     virtual void setObservationId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     416             :     virtual const casacore::Vector<casacore::Int> & processorId () const = 0; // [nR]
     417             :     virtual void setProcessorId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     418             :     virtual const casacore::Vector<casacore::Int> & scan () const = 0; // [nR]
     419             :     virtual void setScan (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     420             :     virtual const casacore::Matrix<casacore::Float> & sigma () const = 0; // [nC, nR]
     421             :     virtual void setSigma (const casacore::Matrix <casacore::Float> & value) = 0; // [nC, nR]
     422             :     virtual const casacore::Vector<casacore::Matrix<casacore::Float>> & sigmas () const = 0; // [nC, nR]
     423             :     virtual void setSigmas (const casacore::Vector<casacore::Matrix <casacore::Float>> & value) = 0; // [nC, nR]
     424             :     //virtual const casacore::Matrix<casacore::Float> & sigmaMat () const = 0; // [nC,nR]
     425             :     virtual const casacore::Vector<casacore::Int> & stateId () const = 0; // [nR]
     426             :     virtual void setStateId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
     427             :     virtual const casacore::Vector<casacore::Double> & time () const = 0; // [nR]
     428             :     virtual void setTime (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
     429             :     virtual const casacore::Vector<casacore::Double> & timeCentroid () const = 0; // [nR]
     430             :     virtual void setTimeCentroid (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
     431             :     virtual const casacore::Vector<casacore::Double> & timeInterval () const = 0; // [nR]
     432             :     virtual void setTimeInterval (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
     433             :     virtual const casacore::Matrix<casacore::Double> & uvw () const = 0; // [3,nR]
     434             :     virtual void setUvw (const casacore::Matrix<casacore::Double> & value) = 0; // [3,nR]
     435             :     virtual const casacore::Matrix<casacore::Float> & weight () const = 0; // [nC, nR]
     436             :     virtual void setWeight (const casacore::Matrix <casacore::Float>& value) = 0; // [nC, nR]
     437             :     virtual const casacore::Vector<casacore::Matrix<casacore::Float>> & weights () const = 0; // [nC, nR]
     438             :     virtual void setWeights (const casacore::Vector<casacore::Matrix <casacore::Float>>& value) = 0; // [nC, nR]
     439             :     //virtual const casacore::Matrix<casacore::Float> & weightMat () const = 0; // [nC,nR]
     440             :     //virtual void setWeightMat (const casacore::Matrix<casacore::Float>& value) = 0; // [nC,nR]
     441             : 
     442             :     virtual const casacore::Cube<casacore::Float> & weightSpectrum () const = 0; // [nC,nF,nR]
     443             :     virtual void setWeightSpectrum (const casacore::Cube<casacore::Float>& value) = 0; // [nC,nF,nR]
     444             :     virtual const casacore::Vector<casacore::Cube<casacore::Float>> & weightSpectra () const = 0; // [nC,nF,nR]
     445             :     virtual void setWeightSpectra (const casacore::Vector<casacore::Cube<casacore::Float>>& value) = 0; // [nC,nF,nR]
     446             : 
     447             :     virtual const casacore::Cube<casacore::Float> & sigmaSpectrum () const = 0; // [nC,nF,nR]
     448             :     virtual void setSigmaSpectrum (const casacore::Cube<casacore::Float>& value) = 0; // [nC,nF,nR]
     449             :     virtual const casacore::Vector<casacore::Cube<casacore::Float>> & sigmaSpectra () const = 0; // [nC,nF,nR]
     450             :     virtual void setSigmaSpectra (const casacore::Vector<casacore::Cube<casacore::Float>>& value) = 0; // [nC,nF,nR]
     451             : 
     452             :     // --------------------------------------------------------------
     453             :     // Visibility data accessors in order of observed, corrected,
     454             :     // float, & model
     455             : 
     456             :     virtual const casacore::Cube<casacore::Complex> & visCube () const = 0; // [nC,nF,nR]
     457             :     virtual void setVisCube(const casacore::Complex & c) = 0;
     458             :     virtual void setVisCube (const casacore::Cube<casacore::Complex> &) = 0; // [nC,nF,nR]
     459             :     virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubes () const = 0; // [nC,nF,nR]
     460             :     virtual void setVisCubes (const casacore::Vector<casacore::Cube<casacore::Complex>> &) = 0; // [nC,nF,nR]
     461             : //    virtual const casacore::Matrix<CStokesVector> & vis () const = 0; // [nF,nR]
     462             : //    virtual void setVis (casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
     463             : 
     464             :     virtual const casacore::Cube<casacore::Complex> & visCubeCorrected () const = 0; // [nC,nF,nR]
     465             :     virtual void setVisCubeCorrected (const casacore::Cube<casacore::Complex> &) = 0; // [nC,nF,nR]
     466             :     virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesCorrected () const = 0; // [nC,nF,nR]
     467             :     virtual void setVisCubesCorrected (const casacore::Vector<casacore::Cube<casacore::Complex>> &) = 0; // [nC,nF,nR]
     468             : //    virtual const casacore::Matrix<CStokesVector> & visCorrected () const = 0; // [nF,nR]
     469             : //    virtual void setVisCorrected (const casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
     470             : 
     471             :     virtual const casacore::Cube<casacore::Float> & visCubeFloat () const = 0; // [nC,nF,nR]
     472             :     virtual void setVisCubeFloat (const casacore::Cube<casacore::Float> &) = 0; // [nC,nF,nR]
     473             :     virtual const casacore::Vector<casacore::Cube<casacore::Float>> & visCubesFloat () const = 0; // [nC,nF,nR]
     474             :     virtual void setVisCubesFloat (const casacore::Vector<casacore::Cube<casacore::Float>> &) = 0; // [nC,nF,nR]
     475             : 
     476             :     virtual const casacore::Cube<casacore::Complex> & visCubeModel () const = 0; // [nC,nF,nR]
     477             :     virtual void setVisCubeModel(const casacore::Complex & c) = 0;
     478             :     virtual void setVisCubeModel(const casacore::Cube<casacore::Complex>& vis) = 0; // [nC,nF,nR]
     479             :     virtual void setVisCubeModel(const casacore::Vector<casacore::Float>& stokes) = 0; // [1..4]
     480             :     virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesModel () const = 0; // [nC,nF,nR]
     481             :     //virtual void setVisCubesModel(const casacore::Complex & c) = 0;
     482             :     virtual void setVisCubesModel(const casacore::Vector<casacore::Cube<casacore::Complex>>& vis) = 0; // [nC,nF,nR]
     483             : //    virtual const casacore::Matrix<CStokesVector> & visModel () const = 0; // [nF,nR]
     484             : //    virtual void setVisModel (casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
     485             : 
     486             :     virtual casacore::Float getWeightScaled (casacore::Int row) const = 0;
     487             :     virtual casacore::Float getWeightScaled (casacore::Int correlation, casacore::Int row) const = 0;
     488             :     virtual casacore::Float getWeightScaled (casacore::Int correlation, casacore::Int channel, casacore::Int row) const = 0;
     489             :     virtual casacore::Float getSigmaScaled (casacore::Int row) const = 0;
     490             :     virtual casacore::Float getSigmaScaled (casacore::Int correlation, casacore::Int row) const = 0;
     491             :     virtual casacore::Float getSigmaScaled (casacore::Int correlation, casacore::Int channel, casacore::Int row) const = 0;
     492             : 
     493             :     //--------------------------------------------------------
     494             :     //
     495             :     // Accessors for data derived from the casacore::MS main table data
     496             : 
     497             :     // Returns the pointing angle for the array as a whole at the
     498             :     // specified time.
     499             : 
     500             :     virtual casacore::MDirection azel0 (casacore::Double time) const = 0;
     501             : 
     502             :     // Returns the pointing angle for each antenna in the array
     503             :     // at the specified time.
     504             : 
     505             :     virtual const casacore::Vector<casacore::MDirection> & azel(casacore::Double time) const = 0; // [nA]
     506             : 
     507             :     // Returns the Jones C matrix for each antenna.
     508             : 
     509             :     virtual const casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > & cjones () const = 0; // [nA]
     510             : 
     511             :     // Returns the correlation type of each correlation in the
     512             :     // VisCube.
     513             : 
     514             :     virtual const casacore::Vector<casacore::Int> & correlationTypes () const = 0; // [nC]
     515             : 
     516             :     // Calculates the parallactic angle for the first receptor of
     517             :     // each antenna at the specified time.
     518             : 
     519             :     virtual const casacore::Vector<casacore::Float> & feedPa(casacore::Double time) const = 0; // [nR]
     520             : 
     521             :     // Calculates the parallactic angle for feed 0 of the
     522             :     // row's Antenna1.
     523             : 
     524             :     virtual const casacore::Vector<casacore::Float> & feedPa1 () const = 0; // [nR]
     525             : 
     526             :     // Calculates the parallactic angle for feed 0 of the
     527             :     // row's Antenna2.
     528             : 
     529             :     virtual const casacore::Vector<casacore::Float> & feedPa2 () const = 0; // [nR]
     530             : 
     531             :     virtual casacore::IPosition getShape () const = 0;
     532             : 
     533             :     // Returns the hour angle of the array at the specified time.
     534             : 
     535             :     virtual casacore::Double hourang(casacore::Double time) const = 0;
     536             : 
     537             :     virtual casacore::Int nAntennas () const = 0;
     538             : 
     539             :     virtual casacore::Int nChannels () const = 0;
     540             : 
     541             :     // Returns the number of correlations along the visCube
     542             :     // correlation axis.  This comes from the "channel" selection and thus can
     543             :     // be anything positive integer (e.g., user could select the same
     544             :     // correlation more than once).
     545             : 
     546             :     virtual casacore::Int nCorrelations () const = 0;
     547             : 
     548             :     // Returns the number of rows in this VisBuffer
     549             :     virtual casacore::rownr_t nRows () const = 0;
     550             : 
     551             :     // Returns the number of distinct cube/array shapes in this VisBuffer
     552             :     virtual casacore::rownr_t nShapes () const = 0;
     553             : 
     554             :     // Returns the number of rows per distinct cube/array shapes in this VisBuffer
     555             :     virtual const casacore::Vector<casacore::rownr_t>& nRowsPerShape () const = 0;
     556             : 
     557             :     // Returns the number of channels per distinct cube/array shapes in this VisBuffer
     558             :     virtual const casacore::Vector<casacore::Int>& nChannelsPerShape () const = 0;
     559             : 
     560             :     // Returns the number of correlation per distinct cube/array shapes in this VisBuffer
     561             :     virtual const casacore::Vector<casacore::Int>& nCorrelationsPerShape () const = 0;
     562             : 
     563             :     // Calculates the parallactic angle of the array as a whole
     564             :     // at the specified time.
     565             : 
     566             :     virtual casacore::Float parang0(casacore::Double time) const = 0;
     567             : 
     568             :     // Calculates the parallactic angle of each antenna in the
     569             :     // array at the specified time.
     570             : 
     571             :     virtual const casacore::Vector<casacore::Float> & parang(casacore::Double time) const = 0; // [nA]
     572             : 
     573             :     // Returns the phase center of the array for the specified
     574             :     // row.
     575             : 
     576             :     virtual const casacore::MDirection& phaseCenter () const = 0;
     577             : 
     578             :     // Returns the polarization frame for the specified row.
     579             : 
     580             :     virtual casacore::Int polarizationFrame () const = 0;
     581             : 
     582             :     virtual casacore::Int polarizationId () const = 0;
     583             : 
     584             :     // The returned casacore::Vector serves as a map between the rows in
     585             :     // the VisBuffer and the row IDs in the underlying casacore::MS main
     586             :     // virtual table:  mainTableID [i] = rowIds () [ i] = 0;
     587             : 
     588             :     virtual const casacore::Vector<casacore::rownr_t> & rowIds () const = 0; // [nR]
     589             : 
     590             :     // Returns the spectral window ID for each row.
     591             :     virtual const casacore::Vector<casacore::Int> & spectralWindows () const = 0; // [nR]
     592             :     virtual void setSpectralWindows (const casacore::Vector<casacore::Int> & spectralWindows) = 0;
     593             : 
     594             :     virtual casacore::CountedPtr<WeightScaling> getWeightScaling () const = 0;
     595             : 
     596             : protected:
     597             : 
     598             :     virtual void associateWithVi2 (const VisibilityIterator2 *);
     599             :     virtual void configureNewSubchunk (casacore::Int msId, const casacore::String & msName, casacore::Bool isNewMs,
     600             :                                        casacore::Bool isNewArrayId, casacore::Bool isNewFieldId,
     601             :                                        casacore::Bool isNewSpectralWindow, const Subchunk & subchunk,
     602             :                                        const casacore::Vector<casacore::rownr_t>& nRowsPerShape,
     603             :                                        const casacore::Vector<casacore::Int>& nChannelsPerShape, 
     604             :                                        const casacore::Vector<casacore::Int>& nCorrelationsPerShape,
     605             :                                        const casacore::Vector<casacore::Int> & correlations,
     606             :                                        const casacore::Vector<casacore::Stokes::StokesTypes> & correlationsDefined,
     607             :                                        const casacore::Vector<casacore::Stokes::StokesTypes> & correlationsSelected,
     608             :                                        casacore::CountedPtr<WeightScaling> weightScaling) = 0;
     609             :     virtual void invalidate() = 0;
     610             :     virtual casacore::Bool isRekeyable () const = 0;
     611             :     virtual void setFillable (casacore::Bool isFillable) = 0;
     612             :     virtual void setRekeyable (casacore::Bool isRekeable) = 0;
     613           0 :     virtual bool setWritability (bool /*newWritability*/) { ThrowCc ("Should be overridden"); } // Kluge
     614             : 
     615             :     virtual casacore::Vector<casacore::Bool> & flagRowRef () = 0;  // [nR]
     616             :     virtual casacore::Cube<casacore::Bool> & flagCubeRef () = 0;  // [nC,nF,nR]
     617             :     virtual casacore::Vector<casacore::Cube<casacore::Bool>> & flagCubesRef () = 0;  // [nC,nF,nR]
     618             :     virtual casacore::Cube<casacore::Complex> & visCubeRef () = 0; // [nC,nF,nR]
     619             :     virtual casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesRef () = 0; // [nC,nF,nR]
     620             :     virtual casacore::Cube<casacore::Complex> & visCubeCorrectedRef () = 0; // [nC,nF,nR]
     621             :     virtual casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesCorrectedRef () = 0; // [nC,nF,nR]
     622             :     virtual casacore::Cube<casacore::Complex> & visCubeModelRef () = 0; // [nC,nF,nR]
     623             :     virtual casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesModelRef () = 0; // [nC,nF,nR]
     624             :     virtual casacore::Cube<casacore::Float> & weightSpectrumRef () = 0; // [nC,nF,nR]
     625             :     virtual casacore::Vector<casacore::Cube<casacore::Float>> & weightSpectraRef () = 0; // [nC,nF,nR]
     626             :     virtual casacore::Cube<casacore::Float> & sigmaSpectrumRef () = 0; // [nC,nF,nR]
     627             :     virtual casacore::Vector<casacore::Cube<casacore::Float>> & sigmaSpectraRef () = 0; // [nC,nF,nR]
     628             : 
     629             : private:
     630             : 
     631             :     const VisibilityIterator2 * associatedVi_p;
     632             : 
     633             : };
     634             : 
     635             : class VisBufferUtil2 {
     636             : 
     637             : public:
     638             : 
     639             :   static void phaseCenterShift(VisBuffer2 & vb, const casacore::Vector<casacore::Double>& phase);
     640             :   static void phaseCenterShift(VisBuffer2 & vb, casacore::Double dx, casacore::Double dy);
     641             : };
     642             : 
     643             : 
     644             : } // end namespace vi
     645             : 
     646             : 
     647             : } //# NAMESPACE CASA - END
     648             : 
     649             : 
     650             : #endif
     651             : 

Generated by: LCOV version 1.16