casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::MeasurementSet Class Reference

A Table intended to hold astronomical data (a set of Measurements). More...

#include <MeasurementSet.h>

Inheritance diagram for casacore::MeasurementSet:
casacore::MSTable< MSMainEnums > casacore::MSMainEnums casacore::Table

Public Member Functions

 MeasurementSet ()
 This constructs an empty MeasurementSet, only useful to assign to (it is not a valid MS yet). More...
 
virtual ~MeasurementSet ()
 As with tables, the destructor writes the table if necessary. More...
 
MeasurementSetoperator= (const MeasurementSet &)
 Assignment operator, reference semantics. More...
 
MeasurementSet referenceCopy (const String &newTableName, const Block< String > &writableColumns) const
 Make a special copy of this MS which references all columns from this MS except those mentioned; those are empty and writable. More...
 
void setMemoryResidentSubtables (const MrsEligibility &mrsEligibility)
 Converts the MS to make the specified set of subtables memory resident. More...
 
String antennaTableName () const
 Return the name of each of the subtables. More...
 
String dataDescriptionTableName () const
 
String dopplerTableName () const
 
String feedTableName () const
 
String fieldTableName () const
 
String flagCmdTableName () const
 
String freqOffsetTableName () const
 
String historyTableName () const
 
String observationTableName () const
 
String pointingTableName () const
 
String polarizationTableName () const
 
String processorTableName () const
 
String sourceTableName () const
 
String spectralWindowTableName () const
 
String stateTableName () const
 
String sysCalTableName () const
 
String weatherTableName () const
 
MSAntennaantenna ()
 Access functions for the subtables, using the MS-like interface for each. More...
 
MSDataDescriptiondataDescription ()
 
MSDopplerdoppler ()
 
MSFeedfeed ()
 
MSFieldfield ()
 
MSFlagCmdflagCmd ()
 
MSFreqOffsetfreqOffset ()
 
MSHistoryhistory ()
 
MSObservationobservation ()
 
MSPointingpointing ()
 
MSPolarizationpolarization ()
 
MSProcessorprocessor ()
 
MSSourcesource ()
 
MSSpectralWindowspectralWindow ()
 
MSStatestate ()
 
MSSysCalsysCal ()
 
MSWeatherweather ()
 
const MSAntennaantenna () const
 
const MSDataDescriptiondataDescription () const
 
const MSDopplerdoppler () const
 
const MSFeedfeed () const
 
const MSFieldfield () const
 
const MSFlagCmdflagCmd () const
 
const MSFreqOffsetfreqOffset () const
 
const MSHistoryhistory () const
 
const MSObservationobservation () const
 
const MSPointingpointing () const
 
const MSPolarizationpolarization () const
 
const MSProcessorprocessor () const
 
const MSSourcesource () const
 
const MSSpectralWindowspectralWindow () const
 
const MSStatestate () const
 
const MSSysCalsysCal () const
 
const MSWeatherweather () const
 
MrsEligibility getMrsEligibility () const
 
void initRefs (Bool clear=False)
 Initialize the references to the subtables. More...
 
void createDefaultSubtables (Table::TableOption option=Table::Scratch)
 Create default subtables: fills the required subtable keywords with tables of the correct type, mainly for testing and as an example of how to do this for specific fillers. More...
 
void createDefaultSubtables (MPI_Comm comm, Table::TableOption option=Table::Scratch)
 
Bool makeComplexData ()
 Create DATA column from existing FLOAT_DATA column. More...
 
Bool validateMeasureRefs ()
 Validate Measure references - check that all Measure columns have their reference value set, report the ones that don't. More...
 
void flush (Bool sync=False)
 Flush all the tables and subtables associated with this MeasurementSet. More...
 
Record msseltoindex (const String &spw="", const String &field="", const String &baseline="", const String &time="", const String &scan="", const String &uvrange="", const String &observation="", const String &poln="", const String &taql="")
 Return a record of the indices that the msselection selection selected. More...
 
 MeasurementSet (const String &tableName, TableOption=Table::Old)
 These constructors mirror the Table ones with additional checking on validity (verifying that the MS will have the required columns and keywords) An exception is thrown if the constructed Table is not a valid MS. More...
 
 MeasurementSet (const String &tableName, const TableLock &lockOptions, TableOption=Table::Old)
 
 MeasurementSet (const String &tableName, const TableLock &lockOptions, bool doNotLockSubtables, TableOption=Table::Old)
 
 MeasurementSet (const String &tableName, const String &tableDescName, TableOption=Table::Old)
 Allows keeping subtables unlocked/read-locked independent of lock mode of main table. More...
 
 MeasurementSet (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption=Table::Old)
 
 MeasurementSet (SetupNewTable &newTab, rownr_t nrrow=0, Bool initialize=False)
 
 MeasurementSet (SetupNewTable &newTab, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False)
 
 MeasurementSet (const Table &table, const MeasurementSet *otherMs=NULL)
 
 MeasurementSet (MPI_Comm comm, SetupNewTable &newTab, rownr_t nrrow=0, Bool initialize=False)
 
 MeasurementSet (MPI_Comm comm, SetupNewTable &newTab, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False)
 
 MeasurementSet (const MeasurementSet &other)
 
- Public Member Functions inherited from casacore::MSTable< MSMainEnums >
Bool validate () const
 validate self (make sure that this MS is valid) More...
 
Bool isColumn (ColEnum which) const
 ColEnum convenience functions. More...
 
Bool isColumnWritable (ColEnum which) const
 check to see if a column is writable More...
 
Bool isColumnWritable (const String &columnName) const
 
Bool isColumnWritable (uInt columnIndex) const
 
Bool isScalar (ColEnum which) const
 Information about scalar vs array of a column. More...
 
Bool isArray (ColEnum which) const
 
const Stringunit (const String &which) const
 Return the UNIT keyword value associated with the specified column. More...
 
const Stringunit (ColEnum which) const
 
Bool isKeyword (KeyEnum which) const
 check to see if a keyword exists More...
 
- Public Member Functions inherited from casacore::Table
 Table ()
 Create a null Table object (i.e. More...
 
 Table (const String &tableName, TableOption=Table::Old, const TSMOption &=TSMOption())
 Create a table object for an existing table. More...
 
 Table (const String &tableName, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
 
 Table (const String &tableName, const String &tableDescName, TableOption=Table::Old, const TSMOption &=TSMOption())
 
 Table (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
 
 Table (TableType, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 Make a new empty table (plain (scratch) or memory type). More...
 
 Table (SetupNewTable &, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 Make a table object for a new table, which can thereafter be used for reading and writing. More...
 
 Table (SetupNewTable &, TableType, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (SetupNewTable &, TableType, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (SetupNewTable &, TableLock::LockOption, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (SetupNewTable &, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, TableType, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, SetupNewTable &, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, SetupNewTable &, TableType, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, SetupNewTable &, TableType, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, SetupNewTable &, TableLock::LockOption, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (MPI_Comm mpiComm, SetupNewTable &, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
 
 Table (const Block< Table > &tables, const Block< String > &subTables=Block< String >(), const String &subDirName=String())
 Create a table object as the virtual concatenation of one or more of existing tables. More...
 
 Table (const Block< String > &tableNames, const Block< String > &subTables=Block< String >(), TableOption=Table::Old, const TSMOption &=TSMOption(), const String &subDirName=String())
 
 Table (const Block< String > &tableNames, const Block< String > &subTables, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
 
 Table (const Table &)
 Copy constructor (reference semantics). More...
 
virtual ~Table ()
 The destructor flushes (i.e. More...
 
Tableoperator= (const Table &)
 Assignment (reference semantics). More...
 
Block< StringgetPartNames (Bool recursive=False) const
 Get the names of the tables this table consists of. More...
 
Bool isSameRoot (const Table &other) const
 Is the root table of this table the same as that of the other one? More...
 
void closeSubTables () const
 Close all open subtables. More...
 
void reopenRW ()
 Try to reopen the table for read/write access. More...
 
Table::EndianFormat endianFormat () const
 Get the endian format in which the table is stored. More...
 
const StorageOptionstorageOption () const
 Get the storage option used for the table. More...
 
Bool isMultiUsed (Bool checkSubTables=False) const
 Is the table used (i.e. More...
 
const TableLocklockOptions () const
 Get the locking options. More...
 
Bool hasLock (FileLocker::LockType=FileLocker::Write) const
 Has this process the read or write lock, thus can the table be read or written safely? More...
 
Bool hasLock (Bool write) const
 
Bool lock (FileLocker::LockType=FileLocker::Write, uInt nattempts=0)
 Try to lock the table for read or write access (default is write). More...
 
Bool lock (Bool write, uInt nattempts=0)
 
void unlock ()
 Unlock the table. More...
 
Bool hasDataChanged ()
 Determine if column or keyword table data have changed (or is being changed) since the last time this function was called. More...
 
void flush (Bool fsync=False, Bool recursive=False)
 Flush the table, i.e. More...
 
void resync ()
 Resynchronize the Table object with the table file. More...
 
Bool isNull () const
 Test if the object is null, i.e. More...
 
void throwIfNull () const
 Throw an exception if the object is null, i.e. More...
 
void showStructure (std::ostream &, Bool showDataMans=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False, Bool cOrder=False) const
 Show the structure of the table. More...
 
void showKeywords (std::ostream &, Bool showSubTables=False, Bool showTabKey=True, Bool showColKey=False, Int maxVal=25) const
 Show the table and/or column keywords, possibly also of all subtables. More...
 
void showKeywordSets (std::ostream &, Bool showTabKey, Bool showColKey, Int maxVal) const
 Show the table and/or column keywords of this table. More...
 
Bool isRootTable () const
 Test if this table is the root table (ie. More...
 
Bool isWritable () const
 Test if this table is opened as writable. More...
 
Bool isColumnWritable (const String &columnName) const
 Test if the given column is writable. More...
 
Bool isColumnWritable (uInt columnIndex) const
 
Bool isColumnStored (const String &columnName) const
 Test if the given column is stored (otherwise it is virtual). More...
 
Bool isColumnStored (uInt columnIndex) const
 
const TableRecordkeywordSet () const
 Get readonly access to the table keyword set. More...
 
TableRecordrwKeywordSet ()
 Get read/write access to the table keyword set. More...
 
const TableInfotableInfo () const
 Get access to the TableInfo object. More...
 
TableInfotableInfo ()
 
void flushTableInfo () const
 Write the TableInfo object. More...
 
const TableDesctableDesc () const
 Get the table description. More...
 
TableDesc actualTableDesc () const
 
Record dataManagerInfo () const
 Return all data managers used and the columns served by them. More...
 
const StringtableName () const
 Get the table name. More...
 
void rename (const String &newName, TableOption)
 Rename the table and all its subtables. More...
 
void copy (const String &newName, TableOption, Bool noRows=False) const
 Copy the table and all its subtables. More...
 
void deepCopy (const String &newName, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
 
void deepCopy (const String &newName, const Record &dataManagerInfo, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
 
void deepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
 
Table copyToMemoryTable (const String &name, Bool noRows=False) const
 Make a copy of a table to a MemoryTable object. More...
 
TableType tableType () const
 Get the table type. More...
 
int tableOption () const
 Get the table option. More...
 
void markForDelete ()
 Mark the table for delete. More...
 
void unmarkForDelete ()
 Unmark the table for delete. More...
 
Bool isMarkedForDelete () const
 Test if the table is marked for delete. More...
 
rownr_t nrow () const
 Get the number of rows. More...
 
Bool canAddRow () const
 Test if it is possible to add a row to this table. More...
 
void addRow (rownr_t nrrow=1, Bool initialize=False)
 Add one or more rows at the end of the table. More...
 
Bool canRemoveRow () const
 Test if it is possible to remove a row from this table. More...
 
void removeRow (rownr_t rownr)
 Remove the given row(s). More...
 
void removeRow (const RowNumbers &rownrs)
 
TableExprNode nodeRownr (rownr_t origin=0) const
 Create a TableExprNode object for the rownumber function. More...
 
TableExprNode nodeRandom () const
 Create a TableExprNode object for the rand function. More...
 
Table operator() (const TableExprNode &, rownr_t maxRow=0, rownr_t offset=0) const
 Select rows from a table using an select expression consisting of TableExprNode objects. More...
 
Table operator() (const RowNumbers &rownrs) const
 Select rows using a vector of row numbers. More...
 
Table operator() (const Block< Bool > &mask) const
 Select rows using a mask block. More...
 
Table project (const Block< String > &columnNames) const
 Project the given columns (i.e. More...
 
Table operator& (const Table &) const
 Do logical operations on a table. More...
 
Table operator| (const Table &) const
 Union with another table. More...
 
Table operator- (const Table &) const
 Subtract another table. More...
 
Table operator^ (const Table &) const
 Xor with another table. More...
 
Table operator! () const
 Take complement. More...
 
Table sort (const String &columnName, int=Sort::Ascending, int=Sort::ParSort) const
 Sort a table on one or more columns of scalars. More...
 
Table sort (const Block< String > &columnNames, int=Sort::Ascending, int=Sort::ParSort) const
 Sort on multiple columns. More...
 
Table sort (const Block< String > &columnNames, const Block< Int > &sortOrders, int=Sort::ParSort) const
 Sort on multiple columns. More...
 
Table sort (const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrders, int=Sort::ParSort) const
 Sort on multiple columns. More...
 
RowNumbers rowNumbers () const
 Get a vector of row numbers in the root table of rows in this table. More...
 
RowNumbers rowNumbers (const Table &that, Bool tryFast=False) const
 Get a vector of row numbers in that table of rows in this table. More...
 
void addColumn (const ColumnDesc &columnDesc, Bool addToParent=True)
 Add a column to the table. More...
 
void addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent=True)
 Use an existing data manager with the given name or type. More...
 
void addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent=True)
 Use the given data manager (which is a new one). More...
 
void addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent=True)
 Add a bunch of columns using the given new data manager. More...
 
void addColumn (const TableDesc &tableDesc, const Record &dataManagerInfo, Bool addToParent=True)
 
Bool canRemoveColumn (const String &columnName) const
 Test if columns can be removed. More...
 
Bool canRemoveColumn (const Vector< String > &columnNames) const
 
void removeColumn (const String &columnName)
 Remove columns. More...
 
void removeColumn (const Vector< String > &columnName)
 
Bool canRenameColumn (const String &columnName) const
 Test if a column can be renamed. More...
 
void renameColumn (const String &newName, const String &oldName)
 Rename a column. More...
 
void renameHypercolumn (const String &newName, const String &oldName)
 
void getTableKeyword (AipsIO &, Bool openWritable)
 Read a table from AipsIO (for TableKeywords). More...
 
DataManagerfindDataManager (const String &name, Bool byColumn=False) const
 Find the data manager with the given name or for the given column name. More...
 
TableExprNode key (const String &keywordName) const
 
Create a TableExprNode object for a column or for a keyword

in the table keyword set. More...

 
TableExprNode key (const Vector< String > &fieldNames) const
 
TableExprNode col (const String &columnName) const
 
TableExprNode col (const String &columnName, const Vector< String > &fieldNames) const
 
TableExprNode keyCol (const String &name, const Vector< String > &fieldNames) const
 

Static Public Member Functions

static MSTableMaps initMaps ()
 Initialize the statics appropriately. More...
 
- Static Public Member Functions inherited from casacore::MSTable< MSMainEnums >
static Bool validate (const TableDesc &tabDesc)
 tableDesc convenience functions More...
 
static Bool validate (const TableRecord &tabKeySet)
 check that the keyword set is valid More...
 
static const TableDescrequiredTableDesc ()
 return the required table description More...
 
static void addColumnCompression (TableDesc &td, ColEnum which, Bool autoScale=True, const String &type=String())
 Add the compress option for the given column to the TableDesc. More...
 
static const StringcolumnName (ColEnum which)
 Convert a ColEnum to the actual column name. More...
 
static ColEnum columnType (const String &name)
 Convert a name to a ColEnum. More...
 
static DataType columnDataType (ColEnum which)
 return the data type for a given ColEnum More...
 
static const StringcolumnStandardComment (ColEnum which)
 return the standard comment for a given ColEnum More...
 
static const StringcolumnUnit (ColEnum which)
 return the UNIT string for a given ColEnum More...
 
static const StringcolumnMeasureType (ColEnum which)
 return the MEASURE_TYPE string for a given ColEnum More...
 
static void addColumnToDesc (TableDesc &tabDesc, ColEnum which, Int ndim=-1, const String &refCol="")
 add a column to a TableDesc An exception is thrown for an invalid data type. More...
 
static void addColumnToDesc (TableDesc &tabDesc, ColEnum which, const IPosition &shape, ColumnDesc::Option option, const String &refCol="")
 add a column to a TableDesc, defining the shape and setting the ColumnDesc option (Fixed, Undefined, Direct) For Measure columns you can define a variable reference column. More...
 
static void addColumnToDesc (MSTableMaps &, ColEnum which, Int ndim=-1, const String &refCol="")
 
static void addColumnToDesc (MSTableMaps &, ColEnum which, const IPosition &shape, ColumnDesc::Option option, const String &refCol="")
 add a column to a TableDesc, defining the shape and setting the ColumnDesc option (Fixed, Undefined, Direct) For Measure columns you can define a variable reference column. More...
 
static const StringkeywordName (KeyEnum which)
 KeyEnum convenience functions. More...
 
static KeyEnum keywordType (const String &name)
 
static DataType keywordDataType (KeyEnum which)
 
static const StringkeywordStandardComment (KeyEnum which)
 
static void addKeyToDesc (TableDesc &, KeyEnum key)
 add a keyword to a TableDesc An exception is thrown for an invalid data type. More...
 
static void addKeyToDesc (MSTableMaps &, KeyEnum key)
 
- Static Public Member Functions inherited from casacore::Table
static ScratchCallbacksetScratchCallback (ScratchCallback *)
 Set the pointer to the ScratchCallback function. More...
 
static Bool isOpened (const String &tableName)
 Is the table used (i.e. More...
 
static uInt nAutoLocks ()
 Determine the number of locked tables opened with the AutoLock option (Locked table means locked for read and/or write). More...
 
static void relinquishAutoLocks (Bool all=False)
 Unlock locked tables opened with the AutoLock option. More...
 
static Vector< StringgetLockedTables (FileLocker::LockType=FileLocker::Read, int lockOption=-1)
 Get the names of tables locked in this process. More...
 
static Bool isNativeDataType (DataType dtype)
 Test if the given data type is native to the table system. More...
 
static String fileName (const String &tableName)
 Make the table file name. More...
 
static Bool isReadable (const String &tableName, bool throwIf=False)
 Test if a table with the given name exists and is readable. More...
 
static Bool isWritable (const String &tableName, bool throwIf=False)
 Test if a table with the given name exists and is writable. More...
 
static Vector< StringnonWritableFiles (const String &tableName)
 Find the non-writable files in a table. More...
 

Protected Member Functions

void clearSubtables ()
 Clears all of the subtable components of this object (i.e., set to value of subtable's default constructor). More...
 
void copySubtable (const Table &otherSubtable, Table &subTable)
 Assigns one subtable to another if the original subtable (otherSubtable) is not null and is also memory resident. More...
 
void copySubtables (const MeasurementSet &other)
 Copies (assigns) all of the non-null subtables from the other MS into this one. More...
 
Bool isEligibleForMemoryResidency (const String &subtableName) const
 Returns true if the named subtable is eligible for memory residency. More...
 
void openMrSubtables ()
 Opens all of the eligible subtables in memory resident form. More...
 
- Protected Member Functions inherited from casacore::MSTable< MSMainEnums >
 ~MSTable ()
 
MSTableoperator= (const MSTable< MSMainEnums > &)
 Assignment operator, reference semantics. More...
 
Table referenceCopy (const String &newTableName, const Block< String > &writableColumns) const
 Return a table that references all columns in this table except for those given in writableColumns, those are empty and writable. More...
 
 MSTable ()
 These constructors mirror the Table ones. More...
 
 MSTable (const String &tableName, TableOption option)
 
 MSTable (const String &tableName, const TableLock &lockOptions, TableOption option)
 
 MSTable (const String &tableName, const String &tableDescName, TableOption option)
 
 MSTable (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption option)
 
 MSTable (SetupNewTable &newTab, rownr_t nrrow, Bool initialize)
 
 MSTable (SetupNewTable &newTab, const TableLock &lockOptions, rownr_t nrrow, Bool initialize)
 
 MSTable (MPI_Comm comm, SetupNewTable &newTab, rownr_t nrrow, Bool initialize)
 
 MSTable (MPI_Comm comm, SetupNewTable &newTab, const TableLock &lockOptions, rownr_t nrrow, Bool initialize)
 
 MSTable (const Table &table)
 
 MSTable (const MSTable< MSMainEnums > &other)
 

Static Protected Member Functions

static String getMrsAipsRcBase ()
 The top level name for MRS related CASARC settings. More...
 
- Static Protected Member Functions inherited from casacore::MSTable< MSMainEnums >
static const StringcolumnName (const MSTableMaps &maps, ColEnum which)
 Convert a ColEnum to the actual column name. More...
 
static DataType columnDataType (const MSTableMaps &maps, ColEnum which)
 
static const StringcolumnStandardComment (const MSTableMaps &maps, ColEnum which)
 
static const StringcolumnUnit (const MSTableMaps &maps, ColEnum which)
 
static const StringcolumnMeasureType (const MSTableMaps &maps, ColEnum which)
 
static const StringkeywordName (const MSTableMaps &maps, KeyEnum which)
 
static DataType keywordDataType (const MSTableMaps &maps, KeyEnum which)
 
static const StringkeywordStandardComment (const MSTableMaps &maps, KeyEnum which)
 
static MSTableMapsgetMaps ()
 Get the static struct containing all column and keyword mappings. More...
 
static void colMapDef (MSTableMaps &maps, ColEnum col, const String &colName, DataType colType, const String &colComment, const String &colUnit="", const String &colMeasureType="")
 Define an entry in the column maps. More...
 
static void keyMapDef (MSTableMaps &maps, KeyEnum key, const String &keyName, DataType keyType, const String &keyComment)
 Define an entry in the keyword maps. More...
 

Private Member Functions

void addCat ()
 temporary function to add the CATEGORY keyword to the FLAG_CATEGORY column if it isn't there yet. More...
 
void checkVersion ()
 check that the MS is the latest version (2.0) More...
 
template<typename T >
void createDefaultSubtables_impl (Table::TableOption option, T comm)
 Creates subtables using an explicit MPI communicator (if MPI support is enabled) More...
 
template<typename Subtable >
void openMrSubtable (Subtable &subtable, const String &subtableName)
 Opens a single subtable as memory resident (if permitted). More...
 
template<typename Subtable >
void openSubtable (Subtable &subtable, const String &subtableName, Bool useLock)
 Opens a single subtable if not present in MS object but defined in on-disk MS. More...
 

Private Attributes

MSAntenna antenna_p
 keep references to the subtables More...
 
MSDataDescription dataDesc_p
 
MSDoppler doppler_p
 
MSFeed feed_p
 
MSField field_p
 
MSFlagCmd flagCmd_p
 
MSFreqOffset freqOffset_p
 
MSHistory history_p
 
MSObservation observation_p
 
MSPointing pointing_p
 
MSPolarization polarization_p
 
MSProcessor processor_p
 
MSSource source_p
 
MSSpectralWindow spectralWindow_p
 
MSState state_p
 
MSSysCal sysCal_p
 
MSWeather weather_p
 
bool doNotLockSubtables_p
 
int mrsDebugLevel_p
 
Bool hasBeenDestroyed_p
 
TableLock mainLock_p
 
Bool memoryResidentSubtables_p
 
MrsEligibility mrsEligibility_p
 

Additional Inherited Members

- Public Types inherited from casacore::MSTable< MSMainEnums >
typedef
MSMainEnums::PredefinedColumns 
ColEnum
 Define the column and keyword enuym types. More...
 
typedef
MSMainEnums::PredefinedKeywords 
KeyEnum
 
- Public Types inherited from casacore::Table
enum  TableOption {
  Old,
  New,
  NewNoReplace,
  Scratch,
  Update,
  Delete
}
 Define the possible options how a table can be opened. More...
 
enum  TableType {
  Plain,
  Memory
}
 Define the possible table types. More...
 
enum  EndianFormat {
  BigEndian,
  LittleEndian,
  LocalEndian,
  AipsrcEndian
}
 Define the possible endian formats in which table data can be stored. More...
 
typedef void ScratchCallback (const String &name, Bool isScratch, const String &oldName)
 Define the signature of the function being called when the state of a scratch table changes (i.e. More...
 
- Public Types inherited from casacore::MSMainEnums
enum  PredefinedColumns {
  UNDEFINED_COLUMN,
  ANTENNA1,
  ANTENNA2,
  ARRAY_ID,
  DATA_DESC_ID,
  EXPOSURE,
  FEED1,
  FEED2,
  FIELD_ID,
  FLAG,
  FLAG_CATEGORY,
  FLAG_ROW,
  INTERVAL,
  OBSERVATION_ID,
  PROCESSOR_ID,
  SCAN_NUMBER,
  SIGMA,
  STATE_ID,
  TIME,
  TIME_CENTROID,
  UVW,
  WEIGHT,
  NUMBER_REQUIRED_COLUMNS,
  ANTENNA3,
  BASELINE_REF,
  CORRECTED_DATA,
  DATA,
  FEED3,
  FLOAT_DATA,
  IMAGING_WEIGHT,
  LAG_DATA,
  MODEL_DATA,
  PHASE_ID,
  PULSAR_BIN,
  PULSAR_GATE_ID,
  SIGMA_SPECTRUM,
  TIME_EXTRA_PREC,
  UVW2,
  VIDEO_POINT,
  WEIGHT_SPECTRUM,
  CORRECTED_WEIGHT_SPECTRUM,
  NUMBER_PREDEFINED_COLUMNS
}
 The Main table colums with predefined meaning. More...
 
enum  PredefinedKeywords {
  UNDEFINED_KEYWORD,
  ANTENNA,
  DATA_DESCRIPTION,
  FEED,
  FIELD,
  FLAG_CMD,
  HISTORY,
  MS_VERSION,
  OBSERVATION,
  POINTING,
  POLARIZATION,
  PROCESSOR,
  SPECTRAL_WINDOW,
  STATE,
  NUMBER_REQUIRED_KEYWORDS,
  CAL_TABLES,
  DOPPLER,
  FREQ_OFFSET,
  SORT_COLUMNS,
  SORT_ORDER,
  SORTED_TABLES,
  SOURCE,
  SYSCAL,
  WEATHER,
  NUMBER_PREDEFINED_KEYWORDS
}
 Keywords with a predefined meaning. More...
 

Detailed Description

A Table intended to hold astronomical data (a set of Measurements).

Intended use:

Public interface

Review Status

Reviewed By:
Bob Garwood
Date Reviewed:
1997/02/01
Test programs:
tMeasurementSet

Prerequisite

Etymology

The MeasurementSet is where all data are ultimately to be found in Casacore. Since, this is a collection of measurements (either actual or simulated), the term MeasurementSet seems appropriate.

Synopsis

A MeasurementSet is a Table. Most operations on a MeasurementSet are Table operations. See the Tables module for a list of those operations. The member functions provided by this class are primarily convenience functions to help users follow the agreed upon column and keyword naming conventions. They are useful when creating a Table following the MeasurementSet conventions from scratch as well as when creating the column objects to access those columns.

The standard way of accessing table columns is through Strings. Mistakes in typing the column name will not be caught at compile time (and may not be caught at run time). We have therefore decided to use an enumeration to specify columns so that many mistakes will be caught at compile time. This requires functions to map to and from this enumeration to the strings that are ultimately used.

Upon destruction, the table is checked to see that the MeasurementSet remains valid, i.e., all required columns are present An exception is thrown if not all required columns are present Nevertheless, the table will be flushed to disk if it is writable - preserving its state.

A MeasurementSet has a number of required subtables. These are stored as keywords in the Table. Access to these subtables is provided via member functions (e.g. antenna() for the ANTENNA table). All subtables have associated MeasurementSet-like classes defined for them (MSAntenna for the ANTENNA table) which provide analogous column and keyword mapping as provided here.

While the class name, MeasurementSet, is descriptive, it is often too long for many common uses. The typedef MS is provided as a convenient shorthand for MeasurementSet. The example below uses this typedef.

Due to the inheritance scheme, it was necessary to separate the enumerations used by MeasurementSet into a separate class, MSMainEnums.

Example

This example illustrates a simple use of the MeasurementSet class.

// create the table descriptor
TableDesc simpleDesc = MS::requiredTableDesc();
// set up a new table
SetupNewTable newTab("simpleTab", simpleDesc, Table::New);
// create the MeasurementSet
MeasurementSet simpleMS(newTab);
// now we need to define all required subtables
// the following call does this for us if we don't need to
// specify details of Storage Managers for columns.
simpleMS.createDefaultSubtables(Table::New);
// fill MeasurementSet via its Table interface
// For example, construct one of the columns
rownr_t rownr = 0;
// add a row
simpleMS.addRow();
// set the values in that row, e.g. the feed column
feed.putScalar(rownr,1);
// Access a subtable
ArrayColumn<Double> antpos(simpleMS.antenna(),
simpleMS.antenna().addRow();
Array<Double> position(3);
position(0)=1.; position(1)=2.; position(2)=3.;
antpos.put(0,position);
// etc.

Motivation

The Table module is more than adequate as a container of data. However, in order for applications to be useful with data from different sources, some conventions need to be adopted in the use of Tables to store data. The MeasurementSet is where those conventions are defined and, to some extent, enforced.

There are a number of reasons why MeasurementSet is more than just a Table.

To Do

Definition at line 241 of file MeasurementSet.h.

Constructor & Destructor Documentation

casacore::MeasurementSet::MeasurementSet ( )

This constructs an empty MeasurementSet, only useful to assign to (it is not a valid MS yet).

casacore::MeasurementSet::MeasurementSet ( const String tableName,
TableOption  = Table::Old 
)

These constructors mirror the Table ones with additional checking on validity (verifying that the MS will have the required columns and keywords) An exception is thrown if the constructed Table is not a valid MS.

Thrown Exceptions

casacore::MeasurementSet::MeasurementSet ( const String tableName,
const TableLock lockOptions,
TableOption  = Table::Old 
)
casacore::MeasurementSet::MeasurementSet ( const String tableName,
const TableLock lockOptions,
bool  doNotLockSubtables,
TableOption  = Table::Old 
)
casacore::MeasurementSet::MeasurementSet ( const String tableName,
const String tableDescName,
TableOption  = Table::Old 
)

Allows keeping subtables unlocked/read-locked independent of lock mode of main table.

casacore::MeasurementSet::MeasurementSet ( const String tableName,
const String tableDescName,
const TableLock lockOptions,
TableOption  = Table::Old 
)
casacore::MeasurementSet::MeasurementSet ( SetupNewTable newTab,
rownr_t  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( SetupNewTable newTab,
const TableLock lockOptions,
rownr_t  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( const Table table,
const MeasurementSet otherMs = NULL 
)
casacore::MeasurementSet::MeasurementSet ( MPI_Comm  comm,
SetupNewTable newTab,
rownr_t  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( MPI_Comm  comm,
SetupNewTable newTab,
const TableLock lockOptions,
rownr_t  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( const MeasurementSet other)
virtual casacore::MeasurementSet::~MeasurementSet ( )
virtual

As with tables, the destructor writes the table if necessary.

Additional checking is done here to verify that all required columns are still present. If it is NOT valid, it will write the table and then throw an exception.

Thrown Exceptions

Member Function Documentation

void casacore::MeasurementSet::addCat ( )
private

temporary function to add the CATEGORY keyword to the FLAG_CATEGORY column if it isn't there yet.

2000/08/22 remove this and the calls next MS update

MSAntenna& casacore::MeasurementSet::antenna ( )
inline

Access functions for the subtables, using the MS-like interface for each.

Definition at line 339 of file MeasurementSet.h.

References antenna_p.

Referenced by casacore::MSInterface::antenna().

const MSAntenna& casacore::MeasurementSet::antenna ( ) const
inline

Definition at line 356 of file MeasurementSet.h.

References antenna_p.

String casacore::MeasurementSet::antennaTableName ( ) const

Return the name of each of the subtables.

This should be used by the filler to create the subtables in the correct location.

void casacore::MeasurementSet::checkVersion ( )
private

check that the MS is the latest version (2.0)

void casacore::MeasurementSet::clearSubtables ( )
protected

Clears all of the subtable components of this object (i.e., set to value of subtable's default constructor).

void casacore::MeasurementSet::copySubtable ( const Table otherSubtable,
Table subTable 
)
protected

Assigns one subtable to another if the original subtable (otherSubtable) is not null and is also memory resident.

void casacore::MeasurementSet::copySubtables ( const MeasurementSet other)
protected

Copies (assigns) all of the non-null subtables from the other MS into this one.

void casacore::MeasurementSet::createDefaultSubtables ( Table::TableOption  option = Table::Scratch)

Create default subtables: fills the required subtable keywords with tables of the correct type, mainly for testing and as an example of how to do this for specific fillers.

In practice these tables will often have more things specified, like dimensions of arrays and storage managers for the various columns.

void casacore::MeasurementSet::createDefaultSubtables ( MPI_Comm  comm,
Table::TableOption  option = Table::Scratch 
)
template<typename T >
void casacore::MeasurementSet::createDefaultSubtables_impl ( Table::TableOption  option,
comm 
)
private

Creates subtables using an explicit MPI communicator (if MPI support is enabled)

MSDataDescription& casacore::MeasurementSet::dataDescription ( )
inline

Definition at line 340 of file MeasurementSet.h.

References dataDesc_p.

Referenced by casacore::MSInterface::dataDescription().

const MSDataDescription& casacore::MeasurementSet::dataDescription ( ) const
inline

Definition at line 357 of file MeasurementSet.h.

References dataDesc_p.

String casacore::MeasurementSet::dataDescriptionTableName ( ) const
MSDoppler& casacore::MeasurementSet::doppler ( )
inline

Definition at line 341 of file MeasurementSet.h.

References doppler_p.

const MSDoppler& casacore::MeasurementSet::doppler ( ) const
inline

Definition at line 358 of file MeasurementSet.h.

References doppler_p.

String casacore::MeasurementSet::dopplerTableName ( ) const
MSFeed& casacore::MeasurementSet::feed ( )
inline

Definition at line 342 of file MeasurementSet.h.

References feed_p.

const MSFeed& casacore::MeasurementSet::feed ( ) const
inline

Definition at line 359 of file MeasurementSet.h.

References feed_p.

String casacore::MeasurementSet::feedTableName ( ) const
MSField& casacore::MeasurementSet::field ( )
inline

Definition at line 343 of file MeasurementSet.h.

References field_p.

Referenced by casacore::MSInterface::field().

const MSField& casacore::MeasurementSet::field ( ) const
inline

Definition at line 360 of file MeasurementSet.h.

References field_p.

String casacore::MeasurementSet::fieldTableName ( ) const
MSFlagCmd& casacore::MeasurementSet::flagCmd ( )
inline

Definition at line 344 of file MeasurementSet.h.

References flagCmd_p.

const MSFlagCmd& casacore::MeasurementSet::flagCmd ( ) const
inline

Definition at line 361 of file MeasurementSet.h.

References flagCmd_p.

String casacore::MeasurementSet::flagCmdTableName ( ) const
void casacore::MeasurementSet::flush ( Bool  sync = False)

Flush all the tables and subtables associated with this MeasurementSet.

This function calls the Table::flush() function on the main table and all the standard subtables including optional subtables. See the Table class for a description of the sync argument.

MSFreqOffset& casacore::MeasurementSet::freqOffset ( )
inline

Definition at line 345 of file MeasurementSet.h.

References freqOffset_p.

const MSFreqOffset& casacore::MeasurementSet::freqOffset ( ) const
inline

Definition at line 362 of file MeasurementSet.h.

References freqOffset_p.

String casacore::MeasurementSet::freqOffsetTableName ( ) const
static String casacore::MeasurementSet::getMrsAipsRcBase ( )
inlinestaticprotected

The top level name for MRS related CASARC settings.

Definition at line 440 of file MeasurementSet.h.

MrsEligibility casacore::MeasurementSet::getMrsEligibility ( ) const
MSHistory& casacore::MeasurementSet::history ( )
inline

Definition at line 346 of file MeasurementSet.h.

References history_p.

const MSHistory& casacore::MeasurementSet::history ( ) const
inline

Definition at line 363 of file MeasurementSet.h.

References history_p.

String casacore::MeasurementSet::historyTableName ( ) const
static MSTableMaps casacore::MeasurementSet::initMaps ( )
static

Initialize the statics appropriately.

This does not need to be called by users, it is called by the implementation class MSTableImpl.

void casacore::MeasurementSet::initRefs ( Bool  clear = False)

Initialize the references to the subtables.

You need to call this only if you assign new subtables to the table keywords. This also checks for validity of the table and its subtables. Set clear to True to clear the subtable references (used in assignment)

Bool casacore::MeasurementSet::isEligibleForMemoryResidency ( const String subtableName) const
protected

Returns true if the named subtable is eligible for memory residency.

Bool casacore::MeasurementSet::makeComplexData ( )

Create DATA column from existing FLOAT_DATA column.

Noop if DATA already exists or neither exists (returns False in that case).

Record casacore::MeasurementSet::msseltoindex ( const String spw = "",
const String field = "",
const String baseline = "",
const String time = "",
const String scan = "",
const String uvrange = "",
const String observation = "",
const String poln = "",
const String taql = "" 
)

Return a record of the indices that the msselection selection selected.

MSObservation& casacore::MeasurementSet::observation ( )
inline

Definition at line 347 of file MeasurementSet.h.

References observation_p.

Referenced by casacore::MSInterface::observation().

const MSObservation& casacore::MeasurementSet::observation ( ) const
inline

Definition at line 364 of file MeasurementSet.h.

References observation_p.

String casacore::MeasurementSet::observationTableName ( ) const
template<typename Subtable >
void casacore::MeasurementSet::openMrSubtable ( Subtable &  subtable,
const String subtableName 
)
private

Opens a single subtable as memory resident (if permitted).

void casacore::MeasurementSet::openMrSubtables ( )
protected

Opens all of the eligible subtables in memory resident form.

template<typename Subtable >
void casacore::MeasurementSet::openSubtable ( Subtable &  subtable,
const String subtableName,
Bool  useLock 
)
private

Opens a single subtable if not present in MS object but defined in on-disk MS.

MeasurementSet& casacore::MeasurementSet::operator= ( const MeasurementSet )

Assignment operator, reference semantics.

MSPointing& casacore::MeasurementSet::pointing ( )
inline

Definition at line 348 of file MeasurementSet.h.

References pointing_p.

const MSPointing& casacore::MeasurementSet::pointing ( ) const
inline

Definition at line 365 of file MeasurementSet.h.

References pointing_p.

String casacore::MeasurementSet::pointingTableName ( ) const
MSPolarization& casacore::MeasurementSet::polarization ( )
inline

Definition at line 349 of file MeasurementSet.h.

References polarization_p.

const MSPolarization& casacore::MeasurementSet::polarization ( ) const
inline

Definition at line 366 of file MeasurementSet.h.

References polarization_p.

String casacore::MeasurementSet::polarizationTableName ( ) const
MSProcessor& casacore::MeasurementSet::processor ( )
inline

Definition at line 350 of file MeasurementSet.h.

References processor_p.

const MSProcessor& casacore::MeasurementSet::processor ( ) const
inline

Definition at line 367 of file MeasurementSet.h.

References processor_p.

String casacore::MeasurementSet::processorTableName ( ) const
MeasurementSet casacore::MeasurementSet::referenceCopy ( const String newTableName,
const Block< String > &  writableColumns 
) const

Make a special copy of this MS which references all columns from this MS except those mentioned; those are empty and writable.

Each forwarded column has the same writable status as the underlying column. The mentioned columns all use the AipsIO storage manager. The main use of this is for the synthesis package where corrected and model visibilities are stored as new DATA columns in an MS which references the raw MS for the other columns. Except for these special cases, the use of this function will be rare.

void casacore::MeasurementSet::setMemoryResidentSubtables ( const MrsEligibility mrsEligibility)

Converts the MS to make the specified set of subtables memory resident.

MSSource& casacore::MeasurementSet::source ( )
inline

Definition at line 351 of file MeasurementSet.h.

References source_p.

const MSSource& casacore::MeasurementSet::source ( ) const
inline

Definition at line 368 of file MeasurementSet.h.

References source_p.

String casacore::MeasurementSet::sourceTableName ( ) const
MSSpectralWindow& casacore::MeasurementSet::spectralWindow ( )
inline

Definition at line 352 of file MeasurementSet.h.

References spectralWindow_p.

Referenced by casacore::MSInterface::spectralWindow().

const MSSpectralWindow& casacore::MeasurementSet::spectralWindow ( ) const
inline

Definition at line 369 of file MeasurementSet.h.

References spectralWindow_p.

String casacore::MeasurementSet::spectralWindowTableName ( ) const
MSState& casacore::MeasurementSet::state ( )
inline

Definition at line 353 of file MeasurementSet.h.

References state_p.

const MSState& casacore::MeasurementSet::state ( ) const
inline

Definition at line 370 of file MeasurementSet.h.

References state_p.

String casacore::MeasurementSet::stateTableName ( ) const
MSSysCal& casacore::MeasurementSet::sysCal ( )
inline

Definition at line 354 of file MeasurementSet.h.

References sysCal_p.

const MSSysCal& casacore::MeasurementSet::sysCal ( ) const
inline

Definition at line 371 of file MeasurementSet.h.

References sysCal_p.

String casacore::MeasurementSet::sysCalTableName ( ) const
Bool casacore::MeasurementSet::validateMeasureRefs ( )

Validate Measure references - check that all Measure columns have their reference value set, report the ones that don't.

MSWeather& casacore::MeasurementSet::weather ( )
inline

Definition at line 355 of file MeasurementSet.h.

References weather_p.

const MSWeather& casacore::MeasurementSet::weather ( ) const
inline

Definition at line 372 of file MeasurementSet.h.

References weather_p.

String casacore::MeasurementSet::weatherTableName ( ) const

Member Data Documentation

MSAntenna casacore::MeasurementSet::antenna_p
private

keep references to the subtables

Definition at line 471 of file MeasurementSet.h.

Referenced by antenna().

MSDataDescription casacore::MeasurementSet::dataDesc_p
private

Definition at line 472 of file MeasurementSet.h.

Referenced by dataDescription().

bool casacore::MeasurementSet::doNotLockSubtables_p
private

Definition at line 489 of file MeasurementSet.h.

MSDoppler casacore::MeasurementSet::doppler_p
private

Definition at line 473 of file MeasurementSet.h.

Referenced by doppler().

MSFeed casacore::MeasurementSet::feed_p
private

Definition at line 474 of file MeasurementSet.h.

Referenced by feed().

MSField casacore::MeasurementSet::field_p
private

Definition at line 475 of file MeasurementSet.h.

Referenced by field().

MSFlagCmd casacore::MeasurementSet::flagCmd_p
private

Definition at line 476 of file MeasurementSet.h.

Referenced by flagCmd().

MSFreqOffset casacore::MeasurementSet::freqOffset_p
private

Definition at line 477 of file MeasurementSet.h.

Referenced by freqOffset().

Bool casacore::MeasurementSet::hasBeenDestroyed_p
private

Definition at line 491 of file MeasurementSet.h.

MSHistory casacore::MeasurementSet::history_p
private

Definition at line 478 of file MeasurementSet.h.

Referenced by history().

TableLock casacore::MeasurementSet::mainLock_p
private

Definition at line 492 of file MeasurementSet.h.

Bool casacore::MeasurementSet::memoryResidentSubtables_p
private

Definition at line 493 of file MeasurementSet.h.

int casacore::MeasurementSet::mrsDebugLevel_p
private

Definition at line 490 of file MeasurementSet.h.

MrsEligibility casacore::MeasurementSet::mrsEligibility_p
private

Definition at line 494 of file MeasurementSet.h.

MSObservation casacore::MeasurementSet::observation_p
private

Definition at line 479 of file MeasurementSet.h.

Referenced by observation().

MSPointing casacore::MeasurementSet::pointing_p
private

Definition at line 480 of file MeasurementSet.h.

Referenced by pointing().

MSPolarization casacore::MeasurementSet::polarization_p
private

Definition at line 481 of file MeasurementSet.h.

Referenced by polarization().

MSProcessor casacore::MeasurementSet::processor_p
private

Definition at line 482 of file MeasurementSet.h.

Referenced by processor().

MSSource casacore::MeasurementSet::source_p
private

Definition at line 483 of file MeasurementSet.h.

Referenced by source().

MSSpectralWindow casacore::MeasurementSet::spectralWindow_p
private

Definition at line 484 of file MeasurementSet.h.

Referenced by spectralWindow().

MSState casacore::MeasurementSet::state_p
private

Definition at line 485 of file MeasurementSet.h.

Referenced by state().

MSSysCal casacore::MeasurementSet::sysCal_p
private

Definition at line 486 of file MeasurementSet.h.

Referenced by sysCal().

MSWeather casacore::MeasurementSet::weather_p
private

Definition at line 487 of file MeasurementSet.h.

Referenced by weather().


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