casa::VisBuffer Class Reference
[MSVis]

#include <VisBuffer.h>

Collaboration diagram for casa::VisBuffer:

Collaboration graph
[legend]
List of all members.

Detailed Description

VisBuffers encapulsate one chunk of visibility data for processing.

Intended use:

Part of API

Prerequisite

Etymology

VisBuffer is a buffer for visibility data

Synopsis

This class contains 'one iteration' of the VisibilityIterator It is a modifiable buffer of values to which calibration and averaging can be applied. This allows processing of the data in larger blocks, avoiding some overheads for processing per visibility point or spectrum.

See MeasurementEquations for more details on how the VisBuffer is to be used.

To Do

Definition at line 79 of file VisBuffer.h.

Public Member Functions

 VisBuffer ()
 Create empty VisBuffer you can assign to or attach.
 VisBuffer (ROVisibilityIterator &iter)
 Construct VisBuffer for a particular VisibilityIterator The buffer will remain synchronized with the iterator.
 VisBuffer (const VisBuffer &vb)
 Copy construct, looses synchronization with iterator: only use buffer for current iteration (or reattach).
 ~VisBuffer ()
 Destructor (detaches from VisIter).
VisBufferoperator= (const VisBuffer &vb)
 Assignment, looses synchronization with iterator: only use buffer for current iteration (or reattach).
VisBufferassign (const VisBuffer &vb, Bool copy=True)
 Assignment, optionally without copying the data across; with copy=True this is identical to normal assignment operator.
VisBufferoperator-= (const VisBuffer &vb)
 subtraction: return the difference of the visibilities, flags of this and other are or-ed.
void attachToVisIter (ROVisibilityIterator &iter)
 Attach to a VisIter.
void invalidate ()
 Invalidate the cache.
void freqAverage ()
 Frequency average the buffer (visibility() column only).
void freqAveCubes ()
 Frequency average the buffer (visCube and [if present] modelVisCube).
void sortCorr ()
 Sort/unsort the correlations, if necessary (Rudimentary handling of non-canonically sorted correlations--use with care!).
void unSortCorr ()
void normalize (const Bool &phaseOnly=False)
 Normalize the visCube by the modelVisCube (and optionally also divide visCube_p by its normalized amp).
void resetWeightMat ()
 Fill weightMat according to sigma column.
void updateCoordInfo ()
 Update coordinate info - useful for copied VisBuffers that need to retain some state for later reference.
void setVisCube (Complex c)
 Set the visibility to a constant, note that this only changes the buffer, no values are written back to tables from here.
void setModelVisCube (Complex c)
void setCorrectedVisCube (Complex c)
void setVisCube (const Cube< Complex > &vis)
 Set the visibility, note that this only changes the buffer, no values are written back to tables from here.
void setModelVisCube (const Cube< Complex > &vis)
void setCorrectedVisCube (const Cube< Complex > &vis)
void refModelVis (const Matrix< CStokesVector > &mvis)
 Reference external model visibilities.
void removeScratchCols ()
 Remove scratch cols data from vb.
const ROMSColumnsmsColumns () const
 Access the current ROMSColumns object via VisIter.
void allSelectedSpectralWindows (Vector< Int > &spws, Vector< Int > &nvischan)
 Get all selected spectral windows not just the one in the actual buffer.
void allSelectedSpectralWindows (Vector< Int > &spws, Vector< Int > &nvischan) const
Int msId () const
 Return the actual msid, useful if using multiple ms to monitor which ms in the list is being dealt with.
Bool newMS () const
 checked if the ms has changed since the last chunk processed
IntnChannel ()
 Access functions.
Int nChannel () const
Vector< Int > & channel ()
const Vector< Int > & channel () const
IntnRow ()
Int nRow () const
Vector< Int > & antenna1 ()
const Vector< Int > & antenna1 () const
Vector< Int > & antenna2 ()
const Vector< Int > & antenna2 () const
Vector< Int > & feed1 ()
const Vector< Int > & feed1 () const
Vector< Int > & feed2 ()
const Vector< Int > & feed2 () const
Vector< Float > & feed1_pa ()
 feed1_pa() and feed2_pa() return an array of parallactic angles (each corresponds to the first receptor of the feed) one for each row in the current buffer.
const Vector< Float > & feed1_pa () const
Vector< Float > & feed2_pa ()
const Vector< Float > & feed2_pa () const
Vector< SquareMatrix< Complex, 2 > > & CJones ()
const Vector< SquareMatrix<
Complex, 2 > > & 
CJones () const
const Vector< Float > & feed_pa (Double time) const
 Note that feed_pa is a function instead of a cached value.
Vector< MDirection > & direction1 ()
 direction1() and direction2() return arrays of directions where the first and the second antenna/feed are pointed to.
const Vector< MDirection > & direction1 () const
Vector< MDirection > & direction2 ()
const Vector< MDirection > & direction2 () const
const Vector< MDirection > & azel (Double time) const
 Note that azel is a function instead of a cached value.
Int fieldId () const
Int arrayId () const
Matrix< Bool > & flag ()
const Matrix< Bool > & flag () const
Cube< Bool > & flagCube ()
const Cube< Bool > & flagCube () const
Vector< Bool > & flagRow ()
const Vector< Bool > & flagRow () const
Vector< Int > & scan ()
const Vector< Int > & scan () const
Int scan0 ()
 scalar version for convenience, when scan known constant for entire iteration/buffer.
Vector< Double > & frequency ()
const Vector< Double > & frequency () const
Vector< Double > & lsrFrequency ()
const Vector< Double > & lsrFrequency () const
void lsrFrequency (const Int &spw, Vector< Double > &freq, Bool convert=False)
 the following method is to convert the observed frequencies This conversion may not be accurate for some frame conversion like topo to lsr except if the spw is in the actual buffer
void lsrFrequency (const Int &spw, Vector< Double > &freq, Bool convert=False) const
MDirectionphaseCenter ()
const MDirectionphaseCenter () const
Int polFrame () const
Vector< Int > & corrType ()
const Vector< Int > & corrType () const
Vector< Float > & sigma ()
const Vector< Float > & sigma () const
Matrix< Float > & sigmaMat ()
const Matrix< Float > & sigmaMat () const
IntspectralWindow ()
Int spectralWindow () const
Int dataDescriptionId () const
Vector< Double > & time ()
const Vector< Double > & time () const
Vector< Double > & timeInterval ()
const Vector< Double > & timeInterval () const
Vector< RigidVector< Double, 3 > > & uvw ()
const Vector< RigidVector<
Double, 3 > > & 
uvw () const
Matrix< CStokesVector > & visibility ()
const Matrix< CStokesVector > & visibility () const
Matrix< CStokesVector > & modelVisibility ()
const Matrix< CStokesVector > & modelVisibility () const
Matrix< CStokesVector > & correctedVisibility ()
const Matrix< CStokesVector > & correctedVisibility () const
Cube< Complex > & visCube ()
const Cube< Complex > & visCube () const
Cube< Complex > & modelVisCube ()
Cube< Complex > & modelVisCube (const Bool &matchVisCubeShape)
const Cube< Complex > & modelVisCube () const
Cube< Complex > & correctedVisCube ()
const Cube< Complex > & correctedVisCube () const
Vector< Float > & weight ()
const Vector< Float > & weight () const
Matrix< Float > & weightMat ()
const Matrix< Float > & weightMat () const
Cube< Float > & weightSpectrum ()
const Cube< Float > & weightSpectrum () const
Matrix< Float > & imagingWeight ()
const Matrix< Float > & imagingWeight () const
Cube< Float > & weightCube ()
Vector< IntvecIntRange (const MSCalEnums::colDef &calEnum) const
 Utility functions to provide coordinate or column ranges of the data in the VisBuffer.
Vector< IntantIdRange () const
 Antenna id.
Bool timeRange (MEpoch &rTime, MVEpoch &rTimeEP, MVEpoch &rInterval) const
 Time range.
Vector< uInt > & rowIds ()
 Return the row Ids from the original ms.
const Vector< uInt > & rowIds () const

Private Member Functions

void validate ()
 validate the cache
IntfillnChannel ()
 functions to fill cache from iterator
Vector< Int > & fillChannel ()
IntfillnRow ()
Vector< Int > & fillAnt1 ()
Vector< Int > & fillAnt2 ()
Vector< Int > & fillFeed1 ()
Vector< Int > & fillFeed2 ()
Vector< Float > & fillFeed1_pa ()
 calling fillFeed1_pa or fillFeed2_pa will fill antenna, feed and time caches automatically
Vector< Float > & fillFeed2_pa ()
Vector< MDirection > & fillDirection1 ()
 calling direction1 or direction2 will fill antenna,feed, time and pa caches automatically
Vector< MDirection > & fillDirection2 ()
Vector< SquareMatrix< Complex, 2 > > & fillCjones ()
IntfillFieldId ()
IntfillArrayId ()
Matrix< Bool > & fillFlag ()
Cube< Bool > & fillFlagCube ()
Vector< Bool > & fillFlagRow ()
Vector< Int > & fillScan ()
Vector< Double > & fillFreq ()
Vector< Double > & fillLSRFreq ()
MDirectionfillPhaseCenter ()
IntfillPolFrame ()
Vector< Int > & fillCorrType ()
Vector< Float > & fillSigma ()
Matrix< Float > & fillSigmaMat ()
IntfillSpW ()
Vector< Double > & fillTime ()
Vector< Double > & fillTimeInterval ()
Vector< RigidVector< Double, 3 > > & filluvw ()
Matrix< CStokesVector > & fillVis (VisibilityIterator::DataColumn whichOne)
Cube< Complex > & fillVisCube (VisibilityIterator::DataColumn whichOne)
Vector< Float > & fillWeight ()
Matrix< Float > & fillWeightMat ()
Cube< Float > & fillWeightSpectrum ()
Matrix< Float > & fillImagingWeight ()
Bool checkMSId ()
Vector< Intunique (const Vector< Int > &indices) const
 Filter index arrays for unique elements.
Bool nonCanonCorr ()
 Are correlations in non-canonical order?

Private Attributes

ROVisibilityIteratorvisIter_p
Bool twoWayConnection_p
Bool corrSorted_p
 Have correlations been sorted by sortCorr?
VisBufferThis
Bool nChannelOK_p
 variables to track validity of cache
Bool channelOK_p
Bool nRowOK_p
Bool ant1OK_p
Bool ant2OK_p
Bool feed1OK_p
Bool feed2OK_p
Bool cjonesOK_p
Bool fieldIdOK_p
Bool arrayIdOK_p
Bool flagOK_p
Bool flagRowOK_p
Bool scanOK_p
Bool freqOK_p
Bool lsrFreqOK_p
Bool phaseCenterOK_p
Bool polFrameOK_p
Bool sigmaOK_p
Bool sigmaMatOK_p
Bool spwOK_p
Bool timeOK_p
Bool timeIntervalOK_p
Bool uvwOK_p
Bool visOK_p
Bool weightOK_p
Bool weightMatOK_p
Bool weightSpectrumOK_p
Bool corrTypeOK_p
Bool flagCubeOK_p
Bool visCubeOK_p
Bool imagingWeightOK_p
Bool modelVisOK_p
Bool correctedVisOK_p
Bool modelVisCubeOK_p
Bool correctedVisCubeOK_p
Bool msOK_p
Bool newMS_p
Bool feed1_paOK_p
Bool feed2_paOK_p
Bool direction1OK_p
Bool direction2OK_p
Bool rowIdsOK_p
Int nChannel_p
 cached variables
Int nRow_p
Vector< Intchannel_p
Vector< Intantenna1_p
Vector< Intantenna2_p
Vector< Intfeed1_p
Vector< Intfeed2_p
Vector< Floatfeed1_pa_p
Vector< Floatfeed2_pa_p
Vector< SquareMatrix< Complex, 2 > > cjones_p
Vector< MDirectiondirection1_p
Vector< MDirectiondirection2_p
Int fieldId_p
Int arrayId_p
Matrix< Boolflag_p
Vector< BoolflagRow_p
Vector< Intscan_p
Vector< Doublefrequency_p
Vector< DoublelsrFrequency_p
MDirection phaseCenter_p
Int polFrame_p
Vector< IntcorrType_p
Vector< Floatsigma_p
Matrix< FloatsigmaMat_p
Int spectralWindow_p
Vector< Doubletime_p
Vector< DoubletimeInterval_p
Vector< RigidVector< Double, 3 > > uvw_p
Matrix< CStokesVectorvisibility_p
Matrix< CStokesVectormodelVisibility_p
Matrix< CStokesVectorcorrectedVisibility_p
Vector< Floatweight_p
Matrix< FloatweightMat_p
Cube< FloatweightSpectrum_p
Cube< BoolflagCube_p
Cube< Complex > visCube_p
Cube< Complex > modelVisCube_p
Cube< Complex > correctedVisCube_p
Vector< uIntrowIds_p
Matrix< FloatimagingWeight_p
Int oldMSId_p
Cube< FloatweightCube_p


Constructor & Destructor Documentation

casa::VisBuffer::VisBuffer (  ) 

Create empty VisBuffer you can assign to or attach.

casa::VisBuffer::VisBuffer ( ROVisibilityIterator iter  ) 

Construct VisBuffer for a particular VisibilityIterator The buffer will remain synchronized with the iterator.

casa::VisBuffer::VisBuffer ( const VisBuffer vb  ) 

Copy construct, looses synchronization with iterator: only use buffer for current iteration (or reattach).

casa::VisBuffer::~VisBuffer (  ) 

Destructor (detaches from VisIter).


Member Function Documentation

VisBuffer& casa::VisBuffer::operator= ( const VisBuffer vb  ) 

Assignment, looses synchronization with iterator: only use buffer for current iteration (or reattach).

VisBuffer& casa::VisBuffer::assign ( const VisBuffer vb,
Bool  copy = True 
)

Assignment, optionally without copying the data across; with copy=True this is identical to normal assignment operator.

VisBuffer& casa::VisBuffer::operator-= ( const VisBuffer vb  ) 

subtraction: return the difference of the visibilities, flags of this and other are or-ed.

An exception is thrown if the number of rows or channels differs, but no further checks are done.

void casa::VisBuffer::attachToVisIter ( ROVisibilityIterator iter  ) 

Attach to a VisIter.

Detaches itself first if already attached to a VisIter. Will remain synchronized with iterator.

void casa::VisBuffer::invalidate (  ) 

Invalidate the cache.

Int& casa::VisBuffer::nChannel (  )  [inline]

Access functions.

Definition at line 118 of file VisBuffer.h.

References fillnChannel(), nChannel_p, and nChannelOK_p.

Referenced by nChannel().

Int casa::VisBuffer::nChannel (  )  const [inline]

Definition at line 119 of file VisBuffer.h.

References nChannel(), and This.

Vector<Int>& casa::VisBuffer::channel (  )  [inline]

Definition at line 121 of file VisBuffer.h.

References channel_p, channelOK_p, and fillChannel().

Referenced by channel().

const Vector<Int>& casa::VisBuffer::channel (  )  const [inline]

Definition at line 122 of file VisBuffer.h.

References channel(), and This.

Int& casa::VisBuffer::nRow (  )  [inline]

Definition at line 124 of file VisBuffer.h.

References fillnRow(), nRow_p, and nRowOK_p.

Referenced by nRow().

Int casa::VisBuffer::nRow (  )  const [inline]

Definition at line 125 of file VisBuffer.h.

References nRow(), and This.

Vector<Int>& casa::VisBuffer::antenna1 (  )  [inline]

Definition at line 127 of file VisBuffer.h.

References ant1OK_p, antenna1_p, and fillAnt1().

Referenced by antenna1().

const Vector<Int>& casa::VisBuffer::antenna1 (  )  const [inline]

Definition at line 128 of file VisBuffer.h.

References antenna1(), and This.

Vector<Int>& casa::VisBuffer::antenna2 (  )  [inline]

Definition at line 130 of file VisBuffer.h.

References ant2OK_p, antenna2_p, and fillAnt2().

Referenced by antenna2().

const Vector<Int>& casa::VisBuffer::antenna2 (  )  const [inline]

Definition at line 131 of file VisBuffer.h.

References antenna2(), and This.

Vector<Int>& casa::VisBuffer::feed1 (  )  [inline]

Definition at line 133 of file VisBuffer.h.

References feed1_p, feed1OK_p, and fillFeed1().

Referenced by feed1().

const Vector<Int>& casa::VisBuffer::feed1 (  )  const [inline]

Definition at line 134 of file VisBuffer.h.

References feed1(), and This.

Vector<Int>& casa::VisBuffer::feed2 (  )  [inline]

Definition at line 136 of file VisBuffer.h.

References feed2_p, feed2OK_p, and fillFeed2().

Referenced by feed2().

const Vector<Int>& casa::VisBuffer::feed2 (  )  const [inline]

Definition at line 137 of file VisBuffer.h.

References feed2(), and This.

Vector<Float>& casa::VisBuffer::feed1_pa (  )  [inline]

feed1_pa() and feed2_pa() return an array of parallactic angles (each corresponds to the first receptor of the feed) one for each row in the current buffer.

In contrast, feed_pa() calculates the angles for each antenna. These methods are implemented for VisBuffer only to benefit from caching of the feed and antenna IDs.

Definition at line 144 of file VisBuffer.h.

References feed1_pa_p, feed1_paOK_p, and fillFeed1_pa().

Referenced by feed1_pa().

const Vector<Float>& casa::VisBuffer::feed1_pa (  )  const [inline]

Definition at line 145 of file VisBuffer.h.

References feed1_pa(), and This.

Vector<Float>& casa::VisBuffer::feed2_pa (  )  [inline]

Definition at line 147 of file VisBuffer.h.

References feed2_pa_p, feed2_paOK_p, and fillFeed2_pa().

Referenced by feed2_pa().

const Vector<Float>& casa::VisBuffer::feed2_pa (  )  const [inline]

Definition at line 148 of file VisBuffer.h.

References feed2_pa(), and This.

Vector<SquareMatrix<Complex,2> >& casa::VisBuffer::CJones (  )  [inline]

Definition at line 150 of file VisBuffer.h.

References cjones_p, cjonesOK_p, and fillCjones().

Referenced by CJones().

const Vector<SquareMatrix<Complex,2> >& casa::VisBuffer::CJones (  )  const [inline]

Definition at line 152 of file VisBuffer.h.

References CJones(), and This.

const Vector<Float>& casa::VisBuffer::feed_pa ( Double  time  )  const