VisBuffer2.h

Go to the documentation of this file.
00001 //# VisBuffer.h: buffer for iterating through MS in large blocks
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 
00027 #ifndef MSVIS_VISBUFFER2_H
00028 #define MSVIS_VISBUFFER2_H
00029 
00030 #include <casa/aips.h>
00031 
00032 //#include <casa/Arrays/Cube.h>
00033 //#include <casa/Arrays/Vector.h>
00034 //#include <casa/Arrays/Matrix.h>
00035 //#include <casa/BasicSL/Complex.h>
00036 #include <casa/BasicSL/Complexfwd.h>
00037 #include <msvis/MSVis/VisBufferComponents2.h>
00038 //#include <msvis/MSVis/VisibilityIterator2.h>
00039 #include <measures/Measures/Stokes.h>
00040 
00041 using casa::vi::VisBufferComponent2;
00042 using casa::vi::VisBufferComponents2;
00043 
00044 namespace casa { //# NAMESPACE CASA - BEGIN
00045 
00046 //#forward
00047 
00048 template <typename T> class Array;
00049 class CStokesVector;
00050 template <typename T> class CountedPtr;
00051 template <typename T> class Cube;
00052 class IPosition;
00053 template <typename T> class Matrix;
00054 class MDirection;
00055 template <typename T, Int N> class SquareMatrix;
00056 template <typename T> class Vector;
00057 
00058 namespace ms {
00059 
00060     class MsRow;
00061 }
00062 
00063 namespace vi {
00064 
00065 class Subchunk;
00066 class ViImplementation2;
00067 class VisibilityIterator2;
00068 class WeightScaling;
00069 
00070 enum VisBufferType : int {VbPlain, VbAsynchronous};
00071 
00072 // These are options to be applied to a VisBuffer, usually when it's created.
00073 // The intent is that these form a bit mask so that they can be used as
00074 // VbWritable | VbRekeyable, etc.  So add the next one in as 2 * theLastOne.
00075 
00076 enum VisBufferOptions : int {VbNoOptions, VbWritable = 1, VbRekeyable = 2};
00077 
00078 //<summary>VisBuffer2s encapsulate one chunk of visibility data for processing.</summary>
00079 //
00080 // <use visibility=export>
00081 //
00082 // <reviewed reviewer="" date="" tests="" demos="">
00083 
00084 // <prerequisite>
00085 //   <li> <linkto class="VisibilityIterator">VisibilityIterator</linkto>
00086 //   <li> <linkto class="VbDirtyComponents">VbDirtyComponents</linkto>
00087 // </prerequisite>
00088 //
00089 // <etymology>
00090 // VisBuffer2 is a buffer for visibility data
00091 // </etymology>
00092 //
00093 //<synopsis>
00094 // The VisBuffer is designed to contain a small amount of visibility-related
00095 // data.  The VisBuffer can be used in two somewhat distinct ways.  The first
00096 // is as an integral (or attached) part of the VisibilityIterator and the second
00097 // is as a free or unattached object.
00098 //
00099 // Attached VisBuffer -- Each VisibilityIterator has a exactly one VisBuffer
00100 // attached to it.  This VisBuffer is created and destroyed by the
00101 // VisibilityIterator.  The role of an attached VB is to contain the data
00102 // currently "pointed to" by the VI.  Because of this tight coupling between
00103 // an attached VI and its VB the operations that can be applied to a VisBuffer
00104 // are somewhat restricted in order to maintain the relationship between the
00105 // MeasurementSet's data and the data i the VisBuffer (failure to do so allows
00106 // obscure bugs to be created).  As such the functions for averaging in either
00107 // the time or frequency axes is not permitted on an attached VB.
00108 //
00109 // Free VisBuffer -- A free VisBuffer is used to contain data that might not
00110 // correspond to the data in the MeasurementSet.  The meaning of the data in
00111 // a free VisBuffer will depend on the user.  Some obvious examples might be:
00112 // a VisBuffer used to resample or average frequencies together; creation of
00113 // "virtual" spectral windows which might reconnect frequencies that were
00114 // split into separate spectral windows becasue of hardware limitation; and
00115 // performing a time average of visibility data.  Because the free VB is not
00116 // tightly coupled to a VI, it is the responsibility of the user to assign
00117 // meaningful values to some of the fields in the VB.  For example, the user
00118 // averaging across time will need to decide what values ought to be reported
00119 // for the VisBuffer's timestamp, pointing angle, etc.
00120 //
00121 // Another possible attribute of a VisBuffer is "rekeyable".  This is for when
00122 // the VisBuffer is being filled by client code rather than from an input MS.
00123 // Because of this, the enforcement of VisBuffer invariants is relaxed.  Users
00124 // will be able to change row key fields (e.g., antenna1, data description id,
00125 // etc.) as well as change the shape of the data.  The method validateShapes is
00126 // provided which will check that all modified shapes are consistent.  This method
00127 // is automatically called by writeChangesBack and should also be called whenever
00128 // the construction process is complete and the VisBuffer is about to be released
00129 // for use; it's better to catch the error rather than letting an inconsistent
00130 // VisBuffer escape into consuming code.
00131 //
00132 //</synopsis>
00133 //
00134 //<todo>
00135 //</todo>
00136 
00137 class VisBuffer2 {
00138 
00139     friend class ViImplementation2;
00140     friend class VisibilityIteratorImpl2;
00141     friend class FinalTvi2;
00142     friend class TransformingVi2;
00143     friend class SimpleSimVi2;
00144 
00145 public:
00146 
00147     // make noncopyable...
00148     VisBuffer2( const VisBuffer2& ) = delete;
00149     VisBuffer2& operator=( const VisBuffer2& ) = delete;
00150 
00151     enum {FrameNotSpecified = -2};
00152 
00153     VisBuffer2 () : associatedVi_p (nullptr) {}
00154 
00155     static VisBuffer2 * factory (VisBufferType t, VisBufferOptions vbOptions = VbNoOptions);
00156 
00157         // Used by framework
00158 
00159     // Destructor (detaches from VisIter)
00160 
00161     virtual ~VisBuffer2() {}
00162 
00163     virtual ms::MsRow * getRow (Int row) const;
00164     virtual ms::MsRow * getRowMutable (Int row);
00165 
00166     //---------------------------------------------------------------------
00167     //
00168     // Copying methods
00169     //
00170     // These methods allow copying portions of the data between two
00171     // VisBuffers.  Because of the complicated semantics of a VisBuffer the
00172     // assignment and copy-construction methods are not used as they are likely
00173     // to confuse VisBuffer users.
00174 
00175 
00176     // Copies all of the components from the specified VisBuffer into this one.
00177     // Uncached values will be cleared in this VB.
00178 
00179     virtual void copy (const VisBuffer2 & other, Bool fetchIfNeeded) = 0;
00180 
00181     // Copies the specified components (or just the ones in the cache if
00182     // fetchIfNeeded is False) from the specified VisBuffer into this one.
00183     // If this VB is not empty it will must have the same shape as the other
00184     // VB unless allowShapeChange is True; in that case this VB will change
00185     // changes to match the other VB flushing the cached data.
00186 
00187     virtual void copyComponents (const VisBuffer2 & other,
00188                                  const VisBufferComponents2 & components,
00189                                  Bool allowShapeChange = False,
00190                                  Bool fetchIfNeeded = True) = 0;
00191 
00192     // Copies the coordinate components (or just the ones in the cache if
00193     // fetchIfNeeded is False) from the specified VisBuffer into this one.
00194     // If this VB is not empty it will must have the same shape as the other
00195     // VB unless allowShapeChange is True; in that case this VB will change
00196     // changes to match the other VB flushing the cached data.
00197     // The basic coordinate components are:
00198     //  Antenna1, Antenna2, ArrayId, DataDescriptionIds, FieldId, SpectralWindows,
00199     //  Time, NRows, Feed1, Feed2
00200     // The directional coordinates (copied if includeDirections is true):
00201     //   Direction1, Direction2, FeedPa1, FeedPa2
00202 
00203     virtual void copyCoordinateInfo(const VisBuffer2 * other,
00204                                     Bool includeDirections,
00205                                     Bool allowShapeChange = False,
00206                                     Bool fetchIfNeeded = True) = 0;
00207 
00208     virtual void setShape (Int nCorrelations, Int nChannels, Int nRows, Bool clearCache = False) = 0;
00209     virtual void validateShapes () const = 0;
00210 
00211     // For attached VBs this returns the VI the VB is attached to.  For free
00212     // VBs this method returns False. N.B.: It should not be used within the framework
00213     // itself; instead access the associated ViImplementation2 object.
00214 
00215     virtual const VisibilityIterator2 * getVi () const;
00216 
00217     virtual Bool isAttached () const = 0;
00218     virtual Bool isFillable () const = 0;
00219 
00220     //---------------------------------------------------------------------
00221     //
00222     //    Dirty component methods
00223     //
00224     //    The dirtyComponent methods support the data-flow approach to using
00225     //    VisBuffers (the Visibility Processing Framework).  In this approach
00226     //    a VisBuffer is passed to successive processing nodes (e.g., applycal,
00227     //    flagging, etc.) which operate  on it and pass it on to the next node
00228     //    in the algorithm. The dirtyComponents mechanism allows a processing
00229     //    node to mark portions of the VisBuffer as modified.  If the VisBuffer
00230     //    reaches an write-to-disk node then the modified portions of the
00231     //    VisBuffer will be written out.  The user can also explicitly direct
00232     //    that the changes be written out using the writeChangesBack method.
00233     //
00234     //    Using a setter on a VisBuffer component will also set the dirty flag for
00235     //    that component.  Normally the user should not need to use these methods;
00236     //    however, they are available in case unexpected situations should arise
00237     //    in the future.
00238 
00239     virtual void writeChangesBack () = 0;
00240     virtual void initWeightSpectrum (const Cube<Float>& wtspec) = 0;
00241     virtual void initSigmaSpectrum (const Cube<Float>& sigspec) = 0;
00242 
00243     virtual void dirtyComponentsAdd (const VisBufferComponents2 & additionalDirtyComponents) = 0;
00244     virtual void dirtyComponentsAdd (VisBufferComponent2 component) = 0;
00245     virtual void dirtyComponentsClear () = 0;
00246     virtual VisBufferComponents2 dirtyComponentsGet () const = 0;
00247     virtual void dirtyComponentsSet (const VisBufferComponents2 & dirtyComponents) = 0;
00248     virtual void dirtyComponentsSet (VisBufferComponent2 component) = 0;
00249 
00250     // This method returns the imagin g
00251     // If an imaging weight generator has not been supplied to the associated
00252     // VisibilityIterator then this method will throw an exception.
00253 
00254     virtual const Matrix<Float> & imagingWeight() const = 0;
00255     virtual void setImagingWeight (const Matrix<Float> & newImagingWeights) = 0;
00256 
00257     //---------------------------------------------------------------------------
00258     //
00259     // Frequency reporting methods.
00260     //
00261     // These methods provide information about the frequencies returned in the
00262     // visibility cubes.  The information can returned as the channel numbers
00263     // (numbered as in the underlying MS data) or in a frame-based frequency.
00264     // This information reported need not be in the same frame of reference
00265     // used to select the data.  If the frame of reference is specified in the
00266     // call, then that is the frame that is used to calculate the frequencies.
00267     // If it is not specified, then the VisibilityIterator will be queried for
00268     // virtual the reportingFrame = 0; if the user has specified a reporting frame to the
00269     // virtual VI then that frame will be used = 0; otherwise the frame used to select
00270     // the frequencies will be used.  If the user provides no frequency selection
00271     // to the VI then the selection frame will TOPO.
00272     //
00273     // Both the channelNumber and frequency reporting methods come in two versions:
00274     // one returns a single frequency for the specified frequency index and row
00275     // while the other provides all of the frequencies for the specified row.
00276     // The frequency index is the zero-based index along the frequency axis of
00277     // a visibility cube.
00278 
00279     virtual Vector<Stokes::StokesTypes> getCorrelationTypesDefined () const = 0;
00280     virtual Vector<Stokes::StokesTypes> getCorrelationTypesSelected () const = 0;
00281     virtual Vector<Int> getCorrelationTypes () const = 0;
00282     virtual Double getFrequency (Int rowInBuffer, Int frequencyIndex,
00283                                  Int frame = FrameNotSpecified) const = 0;
00284     virtual const Vector<Double> & getFrequencies (Int rowInBuffer,
00285                                                    Int frame = FrameNotSpecified) const = 0;
00286     virtual Int getChannelNumber (Int rowInBuffer, Int frequencyIndex) const = 0;
00287     virtual const Vector<Int> & getChannelNumbers (Int rowInBuffer) const = 0;
00288     virtual Vector<Int> getChannelNumbersSelected (Int outputChannelIndex) const = 0;
00289 
00290     // Sort/unsort the correlations, if necessary
00291     //  (Rudimentary handling of non-canonically sorted correlations--use with care!)
00292     //
00293     // The sorting functionality is a horrible kluge that puts the VisBuffer into a
00294     // somewhat incoherent state (e.g., after sorting the correlation types array
00295     // does not correspond to the data) and appears to serve the needs
00296     // of a tiny piece of code.  As such, this refactor is initially not going to
00297     // support this functionality since it is probably better implemented in the one
00298     // place that actually needs it. (jjacobs 10/3/12)
00299     //
00300     //virtual void sortCorr () = 0;
00301     //virtual void unSortCorr() = 0;
00302 
00303     // Normalize the visCube by the modelVisCube.
00304 
00305     virtual void normalize() = 0;
00306 
00307     // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
00308     virtual void phaseCenterShift(const Vector<Double>& phase) = 0;
00309     // Rotate visibility phase for phase center offsets (arcsecs)
00310     virtual void phaseCenterShift(Double dx, Double dy) = 0;
00311 
00312     // Set the weight cube using the sigma cube.  Each weight will be
00313     // the reciprocal of the square of the corresponding element in the model
00314     // VisCube multiplied by the number of channels in the spectral window.
00315     // If an element in sigma is zero then the corresponding weight element
00316     // will also be set to zero.
00317 
00318     virtual void resetWeightsUsingSigma () = 0;//void resetWeightMat() = 0;
00319 
00320     //----------------------------------------------------------------------
00321     //
00322     //  Subhchunk information methods
00323     //
00324     //  These methods provide information related to the current subchunk.
00325     //  The isNewXXX methods return True if the XXX property of the subchunk
00326     //  differs from the previous subchunk.
00327     //
00328     //  The methods msId and msName provide information about the MS
00329     //  related to the current subchunk.  The msID is the zero-based index
00330     //  of the MS in the sequence of MSs being iterated over.
00331     //
00332     //  The isWritable method is True when the attached iterator is writable
00333     //  and False otherwise.
00334     //
00335     //  The isRekeyable method is True when the VisBuffer is writable and also
00336     //  allows the modification of non-data fields (e.g., antenna1, fieldId, etc.)
00337     //  A rekeyable VB is one that could be used to create data for a brand new
00338     //  MS.
00339 
00340     virtual Bool isNewArrayId () const = 0;
00341     virtual Bool isNewFieldId () const = 0;
00342     virtual Bool isNewMs() const = 0;
00343     virtual Bool isNewSpectralWindow () const = 0;
00344     virtual Bool isWritable () const = 0;
00345     virtual Int msId() const /*__attribute__((deprecated))*/ = 0;
00346     virtual String msName (Bool stripPath = False) const /*__attribute__((deprecated))*/ = 0;
00347     virtual Subchunk getSubchunk () const = 0;
00348 
00350     //
00351     //  Data accessors and setters (where appropriate)
00352     //
00353     //  There are the methods that allows access to the items cached in the
00354     //  VisBuffer.  The straight accessors provide read-only access to the
00355     //  item.  Where the item is allowed to be modified, one or more set
00356     //  methods are provided.
00357     //
00358     //  The dimensionality of the major object in in accessor/setter is
00359     //  shown in a trailing comment using the following abbreviations:
00360     //
00361     //  nA :== number of antennas
00362     //  nF :== number of frequencies (or channels)
00363     //  nC :== number of correlations
00364     //  nR :== number of table rows contained in the buffer
00365 
00366     //--------------------------------------------------------
00367     //
00368     // Accessors for data contained in the main MeasurementSet main table
00369     // The actual visibility data are at the end.
00370     //
00371     //  *** N.B.: the VB usually caches the information
00372     //  in the representation requested so that using a setter to modify
00373     //  one value type (e.g., weight or visibility) will not modify the
00374     //  cached value in a different representation (e.g., weightMat or
00375     //  visCube).  This should not be a problem in normal usage.
00376 
00377     virtual const Vector<Int> & antenna1 () const = 0; // [nR]
00378     virtual void setAntenna1 (const Vector<Int> & value) = 0; // [nR]
00379     virtual const Vector<Int> & antenna2 () const = 0; // [nR]
00380     virtual void setAntenna2 (const Vector<Int> & value) = 0; // [nR]
00381     virtual const Vector<Int> & arrayId () const = 0;
00382     virtual void setArrayId (const Vector<Int> & ) = 0;
00383     //virtual Int dataDescriptionId () const = 0;
00384     //virtual void setDataDescriptionId (Int value) = 0;
00385     virtual const Vector<Int> & dataDescriptionIds () const = 0; // [nR]
00386     virtual void setDataDescriptionIds (const Vector<Int> & ) = 0; // [nR]
00387     virtual const Vector<MDirection> & direction1 () const = 0; // [nR]
00388     virtual const Vector<MDirection> & direction2 () const = 0; // [nR]
00389     virtual const Vector<Double> & exposure () const = 0; // [nR]
00390     virtual void setExposure (const Vector<Double> & value) = 0; // [nR]
00391     virtual const Vector<Int> & feed1 () const = 0; // [nR]
00392     virtual void setFeed1 (const Vector<Int> & value) = 0; // [nR]
00393     virtual const Vector<Int> & feed2 () const = 0; // [nR]
00394     virtual void setFeed2 (const Vector<Int> & value) = 0; // [nR]
00395     virtual const Vector<Int> & fieldId () const = 0;
00396     virtual void setFieldId (const Vector<Int> &) = 0;
00397     //virtual const Matrix<Bool> & flag () const = 0; // [nF,nR]
00398     //virtual void setFlag (const Matrix<Bool>& value) = 0; // [nF,nR]
00399     virtual const Array<Bool> & flagCategory () const = 0; // [nC,nF,nCategories,nR]
00400     virtual void setFlagCategory (const Array<Bool>& value) = 0; // [nC,nF,nCategories,nR]
00401     virtual const Cube<Bool> & flagCube () const = 0; // [nC,nF,nR]
00402     virtual void setFlagCube (const Cube<Bool>& value) = 0; // [nC,nF,nR]
00403     virtual const Vector<Bool> & flagRow () const = 0; // [nR]
00404     virtual void setFlagRow (const Vector<Bool>& value) = 0; // [nR]
00405     virtual const Vector<Int> & observationId () const = 0; // [nR]
00406     virtual void setObservationId (const Vector<Int> & value) = 0; // [nR]
00407     virtual const Vector<Int> & processorId () const = 0; // [nR]
00408     virtual void setProcessorId (const Vector<Int> & value) = 0; // [nR]
00409     virtual const Vector<Int> & scan () const = 0; // [nR]
00410     virtual void setScan (const Vector<Int> & value) = 0; // [nR]
00411     virtual const Matrix<Float> & sigma () const = 0; // [nC, nR]
00412     virtual void setSigma (const Matrix <Float> & value) = 0; // [nC, nR]
00413     //virtual const Matrix<Float> & sigmaMat () const = 0; // [nC,nR]
00414     virtual const Vector<Int> & stateId () const = 0; // [nR]
00415     virtual void setStateId (const Vector<Int> & value) = 0; // [nR]
00416     virtual const Vector<Double> & time () const = 0; // [nR]
00417     virtual void setTime (const Vector<Double> & value) = 0; // [nR]
00418     virtual const Vector<Double> & timeCentroid () const = 0; // [nR]
00419     virtual void setTimeCentroid (const Vector<Double> & value) = 0; // [nR]
00420     virtual const Vector<Double> & timeInterval () const = 0; // [nR]
00421     virtual void setTimeInterval (const Vector<Double> & value) = 0; // [nR]
00422     virtual const Matrix<Double> & uvw () const = 0; // [3,nR]
00423     virtual void setUvw (const Matrix<Double> & value) = 0; // [3,nR]
00424     virtual const Matrix<Float> & weight () const = 0; // [nC, nR]
00425     virtual void setWeight (const Matrix <Float>& value) = 0; // [nC, nR]
00426     //virtual const Matrix<Float> & weightMat () const = 0; // [nC,nR]
00427     //virtual void setWeightMat (const Matrix<Float>& value) = 0; // [nC,nR]
00428 
00429     virtual const Cube<Float> & weightSpectrum () const = 0; // [nC,nF,nR]
00430     virtual void setWeightSpectrum (const Cube<Float>& value) = 0; // [nC,nF,nR]
00431 
00432     virtual const Cube<Float> & sigmaSpectrum () const = 0; // [nC,nF,nR]
00433     virtual void setSigmaSpectrum (const Cube<Float>& value) = 0; // [nC,nF,nR]
00434 
00435     // --------------------------------------------------------------
00436     // Visibility data accessors in order of observed, corrected,
00437     // float, & model
00438 
00439     virtual const Cube<Complex> & visCube () const = 0; // [nC,nF,nR]
00440     virtual void setVisCube(const Complex & c) = 0;
00441     virtual void setVisCube (const Cube<Complex> &) = 0; // [nC,nF,nR]
00442 //    virtual const Matrix<CStokesVector> & vis () const = 0; // [nF,nR]
00443 //    virtual void setVis (Matrix<CStokesVector> &) = 0; // [nF,nR]
00444 
00445     virtual const Cube<Complex> & visCubeCorrected () const = 0; // [nC,nF,nR]
00446     virtual void setVisCubeCorrected (const Cube<Complex> &) = 0; // [nC,nF,nR]
00447 //    virtual const Matrix<CStokesVector> & visCorrected () const = 0; // [nF,nR]
00448 //    virtual void setVisCorrected (const Matrix<CStokesVector> &) = 0; // [nF,nR]
00449 
00450     virtual const Cube<Float> & visCubeFloat () const = 0; // [nC,nF,nR]
00451     virtual void setVisCubeFloat (const Cube<Float> &) = 0; // [nC,nF,nR]
00452 
00453     virtual const Cube<Complex> & visCubeModel () const = 0; // [nC,nF,nR]
00454     virtual void setVisCubeModel(const Complex & c) = 0;
00455     virtual void setVisCubeModel(const Cube<Complex>& vis) = 0; // [nC,nF,nR]
00456     virtual void setVisCubeModel(const Vector<Float>& stokes) = 0; // [1..4]
00457 //    virtual const Matrix<CStokesVector> & visModel () const = 0; // [nF,nR]
00458 //    virtual void setVisModel (Matrix<CStokesVector> &) = 0; // [nF,nR]
00459 
00460     virtual Float getWeightScaled (Int row) const = 0;
00461     virtual Float getWeightScaled (Int correlation, Int row) const = 0;
00462     virtual Float getWeightScaled (Int correlation, Int channel, Int row) const = 0;
00463     virtual Float getSigmaScaled (Int row) const = 0;
00464     virtual Float getSigmaScaled (Int correlation, Int row) const = 0;
00465     virtual Float getSigmaScaled (Int correlation, Int channel, Int row) const = 0;
00466 
00467     //--------------------------------------------------------
00468     //
00469     // Accessors for data derived from the MS main table data
00470 
00471     // Returns the pointing angle for the array as a whole at the
00472     // specified time.
00473 
00474     virtual MDirection azel0 (Double time) const = 0;
00475 
00476     // Returns the pointing angle for each antenna in the array
00477     // at the specified time.
00478 
00479     virtual const Vector<MDirection> & azel(Double time) const = 0; // [nA]
00480 
00481     // Returns the Jones C matrix for each antenna.
00482 
00483     virtual const Vector<SquareMatrix<Complex, 2> > & cjones () const = 0; // [nA]
00484 
00485     // Returns the correlation type of each correlation in the
00486     // VisCube.
00487 
00488     virtual const Vector<Int> & correlationTypes () const = 0; // [nC]
00489 
00490     // Calculates the parallactic angle for the first receptor of
00491     // each antenna at the specified time.
00492 
00493     virtual const Vector<Float> & feedPa(Double time) const = 0; // [nR]
00494 
00495     // Calculates the parallactic angle for feed 0 of the
00496     // row's Antenna1.
00497 
00498     virtual const Vector<Float> & feedPa1 () const = 0; // [nR]
00499 
00500     // Calculates the parallactic angle for feed 0 of the
00501     // row's Antenna2.
00502 
00503     virtual const Vector<Float> & feedPa2 () const = 0; // [nR]
00504 
00505     virtual IPosition getShape () const = 0;
00506 
00507     // Returns the hour angle of the array at the specified time.
00508 
00509     virtual Double hourang(Double time) const = 0;
00510 
00511     virtual Int nAntennas () const = 0;
00512 
00513     virtual Int nChannels () const = 0;
00514 
00515     // Returns the number of correlations along the visCube
00516     // correlation axis.  This comes from the "channel" selection and thus can
00517     // be anything positive integer (e.g., user could select the same
00518     // correlation more than once).
00519 
00520     virtual Int nCorrelations () const = 0;
00521 
00522     // Returns the number of rows in this VisBuffer
00523 
00524     virtual Int nRows () const = 0;
00525 
00526     // Calculates the parallactic angle of the array as a whole
00527     // at the specified time.
00528 
00529     virtual Float parang0(Double time) const = 0;
00530 
00531     // Calculates the parallactic angle of each antenna in the
00532     // array at the specified time.
00533 
00534     virtual const Vector<Float> & parang(Double time) const = 0; // [nA]
00535 
00536     // Returns the phase center of the array for the specified
00537     // row.
00538 
00539     virtual const MDirection& phaseCenter () const = 0;
00540 
00541     // Returns the polarization frame for the specified row.
00542 
00543     virtual Int polarizationFrame () const = 0;
00544 
00545     virtual Int polarizationId () const = 0;
00546 
00547     // The returned Vector serves as a map between the rows in
00548     // the VisBuffer and the row IDs in the underlying MS main
00549     // virtual table:  mainTableID [i] = rowIds () [ i] = 0;
00550 
00551     virtual const Vector<uInt> & rowIds () const = 0; // [nR]
00552 
00553     // Returns the spectral window ID for the specified row.
00554 
00555     //virtual Int spectralWindow () const = 0;
00556 
00557     virtual const Vector<Int> & spectralWindows () const = 0; // [nR]
00558     virtual void setSpectralWindows (const Vector<Int> & spectralWindows) = 0;
00559 
00560     virtual CountedPtr<WeightScaling> getWeightScaling () const = 0;
00561 
00562 protected:
00563 
00564     virtual void associateWithVi2 (const VisibilityIterator2 *);
00565     virtual void configureNewSubchunk (Int msId, const String & msName, Bool isNewMs,
00566                                        Bool isNewArrayId, Bool isNewFieldId,
00567                                        Bool isNewSpectralWindow, const Subchunk & subchunk,
00568                                        Int nRows, Int nChannels, Int nCorrelations,
00569                                        const Vector<Int> & correlations,
00570                                        const Vector<Stokes::StokesTypes> & correlationsDefined,
00571                                        const Vector<Stokes::StokesTypes> & correlationsSelected,
00572                                        CountedPtr<WeightScaling> weightScaling) = 0;
00573     static VisBuffer2 * factory (ViImplementation2 * vi, VisBufferType t, VisBufferOptions options);
00574     virtual void invalidate() = 0;
00575     virtual Bool isRekeyable () const = 0;
00576     virtual void setFillable (Bool isFillable) = 0;
00577     virtual void setRekeyable (Bool isRekeable) = 0;
00578     virtual Bool setWritability (bool /*newWritability*/) { ThrowCc ("Should be overridden"); } // Kluge
00579 
00580     virtual Vector<Bool> & flagRowRef () = 0;  // [nR]
00581     virtual Cube<Bool> & flagCubeRef () = 0;  // [nC,nF,nR]
00582     virtual Cube<Complex> & visCubeRef () = 0; // [nC,nF,nR]
00583     virtual Cube<Complex> & visCubeCorrectedRef () = 0; // [nC,nF,nR]
00584     virtual Cube<Complex> & visCubeModelRef () = 0; // [nC,nF,nR]
00585     virtual Cube<Float> & weightSpectrumRef () = 0; // [nC,nF,nR]
00586 
00587 private:
00588 
00589     const VisibilityIterator2 * associatedVi_p;
00590 
00591 };
00592 
00593 class VisBufferUtil2 {
00594 
00595 public:
00596 
00597   static void phaseCenterShift(VisBuffer2 & vb, const Vector<Double>& phase);
00598   static void phaseCenterShift(VisBuffer2 & vb, Double dx, Double dy);
00599 };
00600 
00601 
00602 } // end namespace vi
00603 
00604 
00605 } //# NAMESPACE CASA - END
00606 
00607 
00608 #endif
00609 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1