casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | List of all members
casa::vi::MSIter2 Class Reference

An iterator class for MeasurementSets. More...

#include <MSIter2.h>

Inheritance diagram for casa::vi::MSIter2:
casacore::MSIter

Public Member Functions

 MSIter2 ()
 Default constructor - useful only to assign another iterator later. More...
 
 MSIter2 (const casacore::MeasurementSet &ms, const casacore::Block< int > &sortColumns, double timeInterval=0, bool addDefaultSortColumns=true, bool storeSorted=true)
 
 MSIter2 (const casacore::Block< casacore::MeasurementSet > &mss, const casacore::Block< int > &sortColumns, double timeInterval=0, bool addDefaultSortColumns=true, bool storeSorted=true)
 Same as above with multiple MSs as input. More...
 
 MSIter2 (const MSIter2 &other)
 Copy construct. More...
 
virtual ~MSIter2 ()
 Destructor. More...
 
MSIter2operator= (const MSIter2 &other)
 Assigment. More...
 
virtual void origin ()
 Reset iterator to start of data This specialization resets the time-compare object before calling parent. More...
 
- Public Member Functions inherited from casacore::MSIter
 MSIter ()
 Default constructor - useful only to assign another iterator later. More...
 
 MSIter (const MeasurementSet &ms, const Block< Int > &sortColumns, Double timeInterval=0, Bool addDefaultSortColumns=True, Bool storeSorted=True)
 Construct from MS and a Block of MS column enums specifying the iteration order, if none are specified, ARRAY_ID, FIELD_ID, DATA_DESC_ID, and TIME iteration is implicit (unless addDefaultSortColumns=False) These columns will be added first if they are not specified. More...
 
 MSIter (const Block< MeasurementSet > &mss, const Block< Int > &sortColumns, Double timeInterval=0, Bool addDefaultSortColumns=True, Bool storeSorted=True)
 Same as above with multiple MSs as input. More...
 
 MSIter (const MSIter &other)
 Copy construct. More...
 
MSIterclone () const
 
virtual ~MSIter ()
 Destructor. More...
 
MSIteroperator= (const MSIter &other)
 Assigment. More...
 
void setInterval (Double timeInterval)
 Set or reset the time interval to use for iteration. More...
 
virtual Bool more () const
 Return False if there is no more data. More...
 
virtual MSIteroperator++ (int)
 Advance iterator through data. More...
 
virtual MSIteroperator++ ()
 
const StringkeyChange () const
 Report Name of slowest column that changes at end of current iteration. More...
 
Table table () const
 Return the current Table iteration. More...
 
const MSms () const
 Return reference to the current MS. More...
 
const ROMSColumnsmsColumns () const
 Return reference to the current ROMSColumns. More...
 
Int msId () const
 Return the current MS Id (according to the order in which they appeared in the constructor) More...
 
Bool newMS () const
 Return true if msId has changed since last iteration. More...
 
Int arrayId () const
 Return the current ArrayId. More...
 
Bool newArray () const
 Return True if ArrayId has changed since last iteration. More...
 
Int fieldId () const
 Return the current FieldId. More...
 
Bool newField () const
 Return True if FieldId/Source has changed since last iteration. More...
 
Int spectralWindowId () const
 Return current SpectralWindow. More...
 
Bool newSpectralWindow () const
 Return True if SpectralWindow has changed since last iteration. More...
 
Int dataDescriptionId () const
 Return current DataDescriptionId. More...
 
Bool newDataDescriptionId () const
 Return True if DataDescriptionId has changed since last iteration. More...
 
Int polarizationId () const
 Return current PolarizationId. More...
 
Bool newPolarizationId () const
 Return True if polarization has changed since last iteration. More...
 
Int polFrame () const
 Return frame for polarization (returns PolFrame enum) More...
 
const Vector< Double > & frequency () const
 Return the frequencies corresponding to the DATA matrix. More...
 
const MFrequencyfrequency0 () const
 Return frequency of first channel with reference frame as a Measure. More...
 
const MFrequencyrestFrequency (Int line=0) const
 Return the rest frequency of the specified line as a Measure. More...
 
const MPositiontelescopePosition () const
 Return the telescope position (if a known telescope) or the position of the first antenna (if unknown) More...
 
const Vector< SquareMatrix
< Complex, 2 > > & 
CJones () const
 Return the feed configuration/leakage matrix for feed 0 on each antenna TODO: CJonesAll can be used instead of this method in all instances. More...
 
const Matrix< SquareMatrix
< Complex, 2 > > & 
CJonesAll () const
 Return the feed configuration/leakage matrix for all feeds and antennae First axis is antennaId, 2nd axis is feedId. More...
 
const Matrix< Double > & receptorAngle () const
 Return the receptor angle for feed 0 on each antenna. More...
 
const Cube< Double > & receptorAngles () const
 Return the receptor angles for all feeds and antennae First axis is a receptor number, 2nd axis is antennaId, 3rd axis is feedId. More...
 
Int startChan () const
 Return the channel number of the first channel in the DATA. More...
 
const Vector< String > & antennaMounts () const
 Return a string mount identifier for each antenna. More...
 
const Cube< RigidVector
< Double, 2 > > & 
getBeamOffsets () const
 Return a cube containing pairs of coordinate offset for each receptor of each feed (values are in radians, coordinate system is fixed with antenna and is the same as used to define the BEAM_OFFSET parameter in the feed table). More...
 
Bool allBeamOffsetsZero () const
 True if all elements of the cube returned by getBeamOffsets are zero. More...
 
void getSpwInFreqRange (Block< Vector< Int > > &spw, Block< Vector< Int > > &start, Block< Vector< Int > > &nchan, Double freqStart, Double freqEnd, Double freqStep)
 Get the spw, start and nchan for all the ms's is this msiter that match the frequecy "freqstart-freqStep" and "freqEnd+freqStep" range. More...
 
Int numMS () const
 Get the number of actual ms's associated wth this iterator. More...
 
const MSms (const uInt n) const
 Get a reference to the nth ms in the list of ms associated with this iterator. More...
 
const MDirectionphaseCenter () const
 Returns the phasecenter for the first time stamp of the iteration The time is important for field tables that have polynomial or ephemerides phasecenters, i.e time varying for a given field_id. More...
 
const MDirection phaseCenter (const Int fldID, const Double timeStamp) const
 If the iterator is set so as one iteration has more that 1 value of time stamp or fieldid then the caller should use the phasecenter with field id and time explicitly. More...
 
const StringfieldName () const
 return FIELD table associated current fieldname and sourcename respectively More...
 
const StringsourceName () const
 

Protected Member Functions

void construct2 (const casacore::Block< int > &sortColumns, casacore::Bool addDefaultSortColumns)
 handle the construction details More...
 
virtual void setState ()
 set the iteration state More...
 
virtual void discernEnforcedTimeBounds (casacore::Vector< casacore::Double > &solbounds, casacore::Bool scanBounded)
 
virtual void discernEnforcedTimeBounds (casacore::Vector< casacore::Double > &solbounds, casacore::Bool scanBounded, casacore::Bool fieldBounded)
 
virtual void discernEnforcedTimeBounds (casacore::Vector< casacore::Double > &solbounds, casacore::Bool scanBounded, casacore::Bool fieldBounded, casacore::Double dt)
 
- Protected Member Functions inherited from casacore::MSIter
void construct (const Block< Int > &sortColumns, Bool addDefaultSortColumns)
 handle the construction details More...
 
void advance ()
 advance the iteration More...
 
void setMSInfo ()
 
void setArrayInfo ()
 
void setFeedInfo ()
 
void setDataDescInfo ()
 
void setFieldInfo ()
 
Bool isSubSet (const Vector< uInt > &r1, const Vector< uInt > &r2)
 Determine if the numbers in r1 are a sorted subset of those in r2. More...
 

Additional Inherited Members

- Public Types inherited from casacore::MSIter
enum  PolFrame {
  Circular,
  Linear
}
 
- Protected Attributes inherited from casacore::MSIter
MSIterThis
 
Block< MeasurementSetbms_p
 
PtrBlock< TableIterator * > tabIter_p
 
Block< BooltabIterAtStart_p
 
Int nMS_p
 
CountedPtr< ROMSColumnsmsc_p
 
Table curTable_p
 
Int curMS_p
 
Int lastMS_p
 
Int curArray_p
 
Int lastArray_p
 
Int curSource_p
 
String curFieldName_p
 
String curSourceName_p
 
Int curField_p
 
Int lastField_p
 
Int curSpectralWindow_p
 
Int lastSpectralWindow_p
 
Int curPolarizationId_p
 
Int lastPolarizationId_p
 
Int curDataDescId_p
 
Int lastDataDescId_p
 
Bool more_p
 
Bool newMS_p
 
Bool newArray_p
 
Bool newField_p
 
Bool newSpectralWindow_p
 
Bool newPolarizationId_p
 
Bool newDataDescId_p
 
Bool preselected_p
 
Bool timeDepFeed_p
 
Bool spwDepFeed_p
 
Bool checkFeed_p
 
Int startChan_p
 
Bool storeSorted_p
 Globally control disk storage of SORTED_TABLE. More...
 
Double interval_p
 time selection More...
 
Block< IntpreselectedChanStart_p
 channel selection More...
 
Block< IntpreselectednChan_p
 
ScalarColumn< IntcolArray_p
 columns More...
 
ScalarColumn< IntcolDataDesc_p
 
ScalarColumn< IntcolField_p
 
MDirection phaseCenter_p
 
Double prevFirstTimeStamp_p
 
Matrix< DoublereceptorAnglesFeed0_p
 cache for access functions More...
 
Cube< DoublereceptorAngles_p
 temporary retained for compatibility contain actually a reference to the first plane of receptorAngles_p More...
 
Vector< SquareMatrix< Complex, 2 > > CJonesFeed0_p
 
Matrix< SquareMatrix< Complex, 2 > > CJones_p
 similar to receptorAngle_p More...
 
Vector< StringantennaMounts_p
 
Cube< RigidVector< Double, 2 > > beamOffsets_p
 antenna (e.g. More...
 
Bool allBeamOffsetsZero_p
 each element of the cube in radians) in the antenna coordinate system. More...
 
PolFrame polFrame_p
 are zero (to speed things up in a single beam case) More...
 
Bool freqCacheOK_p
 
Vector< Doublefrequency_p
 
MFrequency frequency0_p
 
MFrequency restFrequency_p
 
MPosition telescopePosition_p
 
CountedPtr< MSIntervaltimeComp_p
 

Detailed Description

An iterator class for MeasurementSets.

Intended use:

Public interface

Prerequisite

Etymology

MSIter stands for the MeasurementSet Iterator class.

Synopsis

An MSIter is a class to traverse a MeasurementSet in various orders. It automatically adds four predefined sort columns to your selection of sort columns (see constructor) so that it can keep track of changes in frequency or polarization setup, field position and sub-array. Note that this can cause iterations to occur in a different way from what you would expect, see examples below. MSIter implements iteration by time interval for the use of e.g., calibration tasks that want to calculate solutions over some interval of time. You can iterate over multiple MeasurementSets with this class.

Example

// The following code iterates by by ARRAY_ID, FIELD_ID, DATA_DESC_ID and
// TIME (all implicitly added columns) and then by baseline (antenna pair),
// in 3000s intervals.
MeasurementSet ms("3C273XC1.ms");
Block<int> sort(2);
sort[0] = MS::ANTENNA1;
sort[1] = MS::ANTENNA2;
Double timeInterval = 3000;
MSIter msIter(ms,sort,timeInteval);
for (msIter.origin(); msIter.more(); msIter++) {
// print out some of the iteration state
cout << msIter.fieldId() << endl;
cout << msIter.fieldName() << endl;
cout << msIter.dataDescriptionId() << endl;
cout << msIter.frequency0() << endl;
cout << msIter.table().nrow() << endl;
process(msIter.table()); // process the data in the current iteration
}
// Output shows only 1 row at a time because the table is sorted on TIME
// first and ANTENNA1, ANTENNA2 next and each baseline occurs only once per
// TIME stamp. The interval has no effect in this case.

Example

// The following code iterates by baseline (antenna pair), TIME, and,
// implicitly, by ARRAY_ID, FIELD_ID and DATA_DESC_ID in 3000s
// intervals.
MeasurementSet ms("3C273XC1.ms");
Block<int> sort(3);
sort[0] = MS::ANTENNA1;
sort[1] = MS::ANTENNA2;
sort[2] = MS::TIME;
Double timeInterval = 3000;
MSIter msIter(ms,sort,timeInteval);
for (msIter.origin(); msIter.more(); msIter++) {
// print out some of the iteration state
cout << msIter.fieldId() << endl;
cout << msIter.fieldName() << endl;
cout << msIter.dataDescriptionId() << endl;
cout << msIter.frequency0() << endl;
cout << msIter.table().nrow() << endl;
process(msIter.table()); // process the data in the current iteration
// Now the output shows 7 rows at a time, all with identical ANTENNA1
// and ANTENNA2 values and TIME values within a 3000s interval.
}

Motivation

This class was originally part of the VisibilityIterator class, but that class was getting too large and complicated. By splitting out the toplevel iteration into this class the code is much easier to understand. It is now also available through the ms tool.

Definition at line 174 of file MSIter2.h.

Constructor & Destructor Documentation

casa::vi::MSIter2::MSIter2 ( )

Default constructor - useful only to assign another iterator later.

Use of other member functions on this object is likely to dump core.

casa::vi::MSIter2::MSIter2 ( const casacore::MeasurementSet ms,
const casacore::Block< int > &  sortColumns,
double  timeInterval = 0,
bool  addDefaultSortColumns = true,
bool  storeSorted = true 
)
casa::vi::MSIter2::MSIter2 ( const casacore::Block< casacore::MeasurementSet > &  mss,
const casacore::Block< int > &  sortColumns,
double  timeInterval = 0,
bool  addDefaultSortColumns = true,
bool  storeSorted = true 
)

Same as above with multiple MSs as input.

casa::vi::MSIter2::MSIter2 ( const MSIter2 other)

Copy construct.

This calls the assigment operator.

virtual casa::vi::MSIter2::~MSIter2 ( )
virtual

Destructor.

Member Function Documentation

void casa::vi::MSIter2::construct2 ( const casacore::Block< int > &  sortColumns,
casacore::Bool  addDefaultSortColumns 
)
protected

handle the construction details

virtual void casa::vi::MSIter2::discernEnforcedTimeBounds ( casacore::Vector< casacore::Double > &  solbounds,
casacore::Bool  scanBounded 
)
protectedvirtual
virtual void casa::vi::MSIter2::discernEnforcedTimeBounds ( casacore::Vector< casacore::Double > &  solbounds,
casacore::Bool  scanBounded,
casacore::Bool  fieldBounded 
)
protectedvirtual
virtual void casa::vi::MSIter2::discernEnforcedTimeBounds ( casacore::Vector< casacore::Double > &  solbounds,
casacore::Bool  scanBounded,
casacore::Bool  fieldBounded,
casacore::Double  dt 
)
protectedvirtual
MSIter2& casa::vi::MSIter2::operator= ( const MSIter2 other)

Assigment.

This will reset the iterator to the origin.

virtual void casa::vi::MSIter2::origin ( )
virtual

Reset iterator to start of data This specialization resets the time-compare object before calling parent.

Reimplemented from casacore::MSIter.

virtual void casa::vi::MSIter2::setState ( )
protectedvirtual

set the iteration state

Reimplemented from casacore::MSIter.


The documentation for this class was generated from the following file: