casacore
|
An iterator class for MeasurementSets. More...
#include <MSIter.h>
Public Types | |
enum | PolFrame { Circular , Linear } |
Public Member Functions | |
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 MeasurementSet &ms, const std::vector< std::pair< String, CountedPtr< BaseCompare >>> &sortColumns) | |
This constructor is similar to the previous ones but the comparison functions used to group the iterations are given explicitly, making the constructor more generic. More... | |
MSIter (const Block< MeasurementSet > &mss, const std::vector< std::pair< String, CountedPtr< BaseCompare >>> &sortColumns) | |
Same as above with multiple MSs as input. More... | |
MSIter (const MSIter &other) | |
Copy construct. More... | |
MSIter * | clone () const |
virtual | ~MSIter () |
Destructor. More... | |
MSIter & | operator= (const MSIter &other) |
Assigment. More... | |
void | setInterval (Double timeInterval) |
Set or reset the time interval to use for iteration. More... | |
virtual void | origin () |
Reset iterator to start of data. More... | |
virtual Bool | more () const |
Return False if there is no more data. More... | |
virtual MSIter & | operator++ (int) |
Advance iterator through data. More... | |
virtual MSIter & | operator++ () |
const String & | keyChange () const |
Report Name of slowest column that changes at end of current iteration. More... | |
Table | table () const |
Return the current Table iteration. More... | |
const MS & | ms () const |
Return reference to the current MS. More... | |
const MSColumns & | msColumns () const |
Return reference to the current MSColumns. More... | |
size_t | 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... | |
const ScalarColumn< Int > & | colArrayIds () const |
Return the current ArrayIds for all rows in this iteration. More... | |
const ScalarColumn< Int > & | colFieldIds () const |
Return the current FieldIds for all rows in this iteration. More... | |
const ScalarColumn< Int > & | colDataDescriptionIds () const |
Return the current DataDescriptionIds for all rows in this iteration. More... | |
Int | arrayId () const |
Return the ArrayId of the first element in this iteration. More... | |
Bool | newArray () const |
Return True if ArrayId has changed since last iteration Note that if MS_ARRAY is not part of the sorting columns this will always be true. More... | |
Int | fieldId () const |
Return the FieldId of the first element in this iteration. More... | |
Bool | newField () const |
Return True if FieldId/Source has changed since last iteration Note that if MS_FIELD_ID is not part of the sorting columns this will always be true. More... | |
Int | spectralWindowId () const |
Return SpectralWindow of the first element in this iteration. More... | |
Bool | newSpectralWindow () const |
Return True if SpectralWindow has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true. More... | |
Int | dataDescriptionId () const |
Return DataDescriptionId of the first element in this iteration. More... | |
Bool | newDataDescriptionId () const |
Return True if DataDescriptionId has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true. More... | |
Int | polarizationId () const |
Return PolarizationId of the first element in this iteration. More... | |
Bool | newPolarizationId () const |
Return True if polarization has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true. More... | |
Int | polFrame () const |
Return frame for polarization of the first element in this iteration. More... | |
const Vector< Double > & | frequency () const |
Return the frequencies corresponding to the DATA matrix. More... | |
const MFrequency & | frequency0 () const |
Return frequency of first channel of the first element in iteration with reference frame as a Measure. More... | |
const MFrequency & | restFrequency (Int line=0) const |
Return the rest frequency of the specified line as a Measure. More... | |
const MPosition & | telescopePosition () 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... | |
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... | |
size_t | numMS () const |
Get the number of actual ms's associated wth this iterator. More... | |
const MS & | ms (const size_t n) const |
Get a reference to the nth ms in the list of ms associated with this iterator. More... | |
const MDirection & | phaseCenter () 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 String & | fieldName () const |
return FIELD table associated current fieldname and sourcename respectively More... | |
const String & | sourceName () const |
Protected Member Functions | |
void | construct (const Block< Int > &sortColumns, Bool addDefaultSortColumns) |
handle the construction details More... | |
void | construct (const std::vector< std::pair< String, CountedPtr< BaseCompare >>> &sortColumns) |
handle the construction details using explicit comparison functions More... | |
void | advance () |
advance the iteration More... | |
virtual void | setState () |
set the iteration state More... | |
void | setMSInfo () |
void | setArrayInfo () |
void | setFeedInfo () |
void | setDataDescInfo () |
void | setFieldInfo () |
Bool | isSubSet (const Vector< rownr_t > &r1, const Vector< rownr_t > &r2) |
Determine if the numbers in r1 are a sorted subset of those in r2. More... | |
An iterator class for MeasurementSets.
Public interface
MSIter stands for the MeasurementSet Iterator class.
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.
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.
casacore::MSIter::MSIter | ( | ) |
Default constructor - useful only to assign another iterator later.
Use of other member functions on this object is likely to dump core.
casacore::MSIter::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.
An optional timeInterval can be given to iterate through chunks of time. The default interval of 0 groups all times together. Every 'chunk' of data contains all data within a certain time interval and with identical values of the other iteration columns (e.g. DATA_DESCRIPTION_ID and FIELD_ID). See the examples above for the effect of different sort orders.
The storeSorted parameter determines how the resulting SORT_TABLE is managed. If storeSorted is true then the table will be stored on disk; this potentially allows its reuse in the future but has also been shown to be a problem when the MS is being read in parallel. If storeSorted is false then the SORTED_TABLE is constructed and used in memory which keeps concurrent readers from interfering with each other.
casacore::MSIter::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.
casacore::MSIter::MSIter | ( | const MeasurementSet & | ms, |
const std::vector< std::pair< String, CountedPtr< BaseCompare >>> & | sortColumns | ||
) |
This constructor is similar to the previous ones but the comparison functions used to group the iterations are given explicitly, making the constructor more generic.
Also, the column is specified as a string, to support sorting by columns not part of the standard MS definition.
casacore::MSIter::MSIter | ( | const Block< MeasurementSet > & | mss, |
const std::vector< std::pair< String, CountedPtr< BaseCompare >>> & | sortColumns | ||
) |
Same as above with multiple MSs as input.
casacore::MSIter::MSIter | ( | const MSIter & | other | ) |
Copy construct.
This calls the assigment operator.
|
virtual |
Destructor.
|
protected |
advance the iteration
|
inline |
True if all elements of the cube returned by getBeamOffsets are zero.
Definition at line 516 of file MSIter.h.
References allBeamOffsetsZero_p.
Return a string mount identifier for each antenna.
Definition at line 512 of file MSIter.h.
References antennaMounts_p.
|
inline |
Return the ArrayId of the first element in this iteration.
Definition at line 493 of file MSIter.h.
References curArrayIdFirst_p.
|
inline |
Return the feed configuration/leakage matrix for feed 0 on each antenna TODO: CJonesAll can be used instead of this method in all instances.
Definition at line 504 of file MSIter.h.
References CJonesFeed0_p.
|
inline |
MSIter* casacore::MSIter::clone | ( | ) | const |
|
inline |
Return the current ArrayIds for all rows in this iteration.
Definition at line 487 of file MSIter.h.
References colArray_p.
|
inline |
Return the current DataDescriptionIds for all rows in this iteration.
Definition at line 491 of file MSIter.h.
References colDataDesc_p.
|
inline |
Return the current FieldIds for all rows in this iteration.
Definition at line 489 of file MSIter.h.
References colField_p.
|
protected |
handle the construction details
|
protected |
handle the construction details using explicit comparison functions
|
inline |
Return DataDescriptionId of the first element in this iteration.
Definition at line 498 of file MSIter.h.
References curDataDescIdFirst_p.
|
inline |
Return the FieldId of the first element in this iteration.
Definition at line 494 of file MSIter.h.
References curFieldIdFirst_p.
const String& casacore::MSIter::fieldName | ( | ) | const |
return FIELD table associated current fieldname and sourcename respectively
Return the frequencies corresponding to the DATA matrix.
const MFrequency& casacore::MSIter::frequency0 | ( | ) | const |
Return frequency of first channel of the first element in iteration with reference frame as a Measure.
The reference frame Epoch is that of the first row, reset it as needed for each row. The reference frame Position is the average of the antenna positions.
|
inline |
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).
The cube axes are receptor, antenna, feed.
Definition at line 514 of file MSIter.h.
References beamOffsets_p.
void casacore::MSIter::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.
|
protected |
Determine if the numbers in r1 are a sorted subset of those in r2.
const String& casacore::MSIter::keyChange | ( | ) | const |
Report Name of slowest column that changes at end of current iteration.
|
inlinevirtual |
|
inline |
const MS& casacore::MSIter::ms | ( | const size_t | n | ) | const |
Get a reference to the nth ms in the list of ms associated with this iterator.
If larger than the list of ms's current ms is returned So better check wth numMS() before making the call
|
inline |
|
inline |
|
inline |
Return True if ArrayId has changed since last iteration Note that if MS_ARRAY is not part of the sorting columns this will always be true.
Definition at line 481 of file MSIter.h.
References newArrayId_p.
|
inline |
Return True if DataDescriptionId has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true.
Definition at line 500 of file MSIter.h.
References newDataDescId_p.
|
inline |
Return True if FieldId/Source has changed since last iteration Note that if MS_FIELD_ID is not part of the sorting columns this will always be true.
Definition at line 482 of file MSIter.h.
References newFieldId_p.
|
inline |
|
inline |
Return True if polarization has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true.
Definition at line 499 of file MSIter.h.
References newPolarizationId_p.
|
inline |
Return True if SpectralWindow has changed since last iteration Note that if MS_DATA_DESC_ID is not part of the sorting columns this will always be true.
Definition at line 483 of file MSIter.h.
References newSpectralWindowId_p.
|
inline |
|
virtual |
|
virtual |
Advance iterator through data.
Assigment.
This will reset the iterator to the origin.
|
virtual |
Reset iterator to start of data.
const MDirection& casacore::MSIter::phaseCenter | ( | ) | 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.
. If the iterator is set so as one iteration has more that 1 time stamp then this version is correct only for fixed phasecenters
const MDirection casacore::MSIter::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.
|
inline |
Return PolarizationId of the first element in this iteration.
Definition at line 497 of file MSIter.h.
References curPolarizationId_p.
|
inline |
Return frame for polarization of the first element in this iteration.
Definition at line 501 of file MSIter.h.
References polFrame_p.
Return the receptor angle for feed 0 on each antenna.
First axis is receptor number, 2nd axis is antennaId. TODO: receptorAngles() can be used instead of this method
Definition at line 508 of file MSIter.h.
References receptorAnglesFeed0_p.
Return the receptor angles for all feeds and antennae First axis is a receptor number, 2nd axis is antennaId, 3rd axis is feedId.
Result of receptorAngle() is just a reference to the first plane of the cube returned by this method
Definition at line 510 of file MSIter.h.
References receptorAngles_p.
const MFrequency& casacore::MSIter::restFrequency | ( | Int | line = 0 | ) | const |
Return the rest frequency of the specified line as a Measure.
|
protected |
|
protected |
|
protected |
|
protected |
void casacore::MSIter::setInterval | ( | Double | timeInterval | ) |
Set or reset the time interval to use for iteration.
You should call origin() to reset the iteration after calling this.
|
protected |
|
protectedvirtual |
set the iteration state
const String& casacore::MSIter::sourceName | ( | ) | const |
|
inline |
Return SpectralWindow of the first element in this iteration.
Definition at line 495 of file MSIter.h.
References curSpectralWindowIdFirst_p.
|
inline |
|
inline |
Return the telescope position (if a known telescope) or the position of the first antenna (if unknown)
Definition at line 502 of file MSIter.h.
References telescopePosition_p.
|
protected |
each element of the cube in radians) in the antenna coordinate system.
Cube axes are: receptor, antenna, feed.
Definition at line 462 of file MSIter.h.
Referenced by allBeamOffsetsZero().
Definition at line 456 of file MSIter.h.
Referenced by antennaMounts().
|
protected |
antenna (e.g.
EQUATORIAL, ALT-AZ,...)
Definition at line 458 of file MSIter.h.
Referenced by getBeamOffsets().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 443 of file MSIter.h.
Referenced by colDataDescriptionIds().
|
protected |
Definition at line 443 of file MSIter.h.
Referenced by colFieldIds().
|
protected |
|
protected |
Definition at line 431 of file MSIter.h.
Referenced by dataDescriptionId().
|
protected |
|
protected |
|
protected |
Definition at line 430 of file MSIter.h.
Referenced by polarizationId().
|
protected |
Definition at line 429 of file MSIter.h.
Referenced by spectralWindowId().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 424 of file MSIter.h.
Referenced by msColumns().
|
protected |
Definition at line 432 of file MSIter.h.
Referenced by newArray().
|
protected |
Definition at line 433 of file MSIter.h.
Referenced by newDataDescriptionId().
|
protected |
Definition at line 432 of file MSIter.h.
Referenced by newField().
|
protected |
|
protected |
Definition at line 433 of file MSIter.h.
Referenced by newPolarizationId().
|
protected |
Definition at line 432 of file MSIter.h.
Referenced by newSpectralWindow().
|
protected |
|
protected |
|
protected |
are zero (to speed things up in a single beam case)
Definition at line 465 of file MSIter.h.
Referenced by polFrame().
temporary retained for compatibility contain actually a reference to the first plane of receptorAngles_p
Definition at line 452 of file MSIter.h.
Referenced by receptorAngles().
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 470 of file MSIter.h.
Referenced by telescopePosition().
|
protected |
|
protected |