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::PredefinedColumns, MSMainEnums::PredefinedKeywords > casacore::MSMainEnums casacore::Table

List of all members.

Public Member Functions

 MeasurementSet ()
 This constructs an empty MeasurementSet, only useful to assign to (it is not a valid MS yet).
virtual ~MeasurementSet ()
 As with tables, the destructor writes the table if necessary.
MeasurementSetoperator= (const MeasurementSet &)
 Assignment operator, reference semantics.
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.
void setMemoryResidentSubtables (const MrsEligibility &mrsEligibility)
 Converts the MS to make the specified set of subtables memory resident.
String antennaTableName () const
 Return the name of each of the subtables.
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.
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.
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.
Bool makeComplexData ()
 Create DATA column from existing FLOAT_DATA column.
Bool validateMeasureRefs ()
 Validate Measure references - check that all Measure columns have their reference value set, report the ones that don't.
void flush (Bool sync=False)
 Flush all the tables and subtables associated with this MeasurementSet.
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.



 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.
 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.
 MeasurementSet (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption=Table::Old)
 MeasurementSet (SetupNewTable &newTab, uInt nrrow=0, Bool initialize=False)
 MeasurementSet (SetupNewTable &newTab, const TableLock &lockOptions, uInt nrrow=0, Bool initialize=False)
 MeasurementSet (const Table &table, const MeasurementSet *otherMs=NULL)
 MeasurementSet (const MeasurementSet &other)

Static Public Member Functions

static void init ()
 Initialize the statics appropriately.

Protected Member Functions

void clearSubtables ()
 Clears all of the subtable components of this object (i.e., set to value of subtable's default constructor).
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.
void copySubtables (const MeasurementSet &other)
 Copies (assigns) all of the non-null subtables from the other MS into this one.
Bool isEligibleForMemoryResidency (const String &subtableName) const
 Returns true if the named subtable is eligible for memory residency.
void openMrSubtables ()
 Opens all of the eligible subtables in memory resident form.

Static Protected Member Functions

static String getMrsAipsRcBase ()
 The top level name for MRS related CASARC settings.

Private Member Functions

void addCat ()
 temporary function to add the CATEGORY keyword to the FLAG_CATEGORY column if it isn't there yet.
void checkVersion ()
 check that the MS is the latest version (2.0)
template<typename Subtable >
void openMrSubtable (Subtable &subtable, const String &subtableName)
 Opens a single subtable as memory resident (if permitted).
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.

Private Attributes

MSAntenna antenna_p
 keep references to the subtables
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

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
 TableColumn feed(simpleMS, MS::columnName(MS::FEED1));
 uInt 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(),
 MSAntenna::columnName(MSAntenna::POSITION));
 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,
uInt  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( SetupNewTable newTab,
const TableLock lockOptions,
uInt  nrrow = 0,
Bool  initialize = False 
)
casacore::MeasurementSet::MeasurementSet ( const Table table,
const MeasurementSet otherMs = NULL 
)
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

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

Definition at line 349 of file MeasurementSet.h.

References antenna_p.

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

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

Definition at line 332 of file MeasurementSet.h.

References antenna_p.

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

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.

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

Definition at line 350 of file MeasurementSet.h.

References dataDesc_p.

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

Definition at line 333 of file MeasurementSet.h.

References dataDesc_p.

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

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

Definition at line 351 of file MeasurementSet.h.

References doppler_p.

MSDoppler& casacore::MeasurementSet::doppler (  )  [inline]

Definition at line 334 of file MeasurementSet.h.

References doppler_p.

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

Definition at line 352 of file MeasurementSet.h.

References feed_p.

MSFeed& casacore::MeasurementSet::feed (  )  [inline]

Definition at line 335 of file MeasurementSet.h.

References feed_p.

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

Definition at line 353 of file MeasurementSet.h.

References field_p.

MSField& casacore::MeasurementSet::field (  )  [inline]

Definition at line 336 of file MeasurementSet.h.

References field_p.

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

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

Definition at line 354 of file MeasurementSet.h.

References flagCmd_p.

MSFlagCmd& casacore::MeasurementSet::flagCmd (  )  [inline]

Definition at line 337 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.

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

Definition at line 355 of file MeasurementSet.h.

References freqOffset_p.

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

Definition at line 338 of file MeasurementSet.h.

References freqOffset_p.

String casacore::MeasurementSet::freqOffsetTableName (  )  const
static String casacore::MeasurementSet::getMrsAipsRcBase (  )  [inline, static, protected]

The top level name for MRS related CASARC settings.

Definition at line 430 of file MeasurementSet.h.

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

Definition at line 356 of file MeasurementSet.h.

References history_p.

MSHistory& casacore::MeasurementSet::history (  )  [inline]

Definition at line 339 of file MeasurementSet.h.

References history_p.

String casacore::MeasurementSet::historyTableName (  )  const
static void casacore::MeasurementSet::init (  )  [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.

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

Definition at line 357 of file MeasurementSet.h.

References observation_p.

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

Definition at line 340 of file MeasurementSet.h.

References observation_p.

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

String casacore::MeasurementSet::observationTableName (  )  const
template<typename Subtable >
void casacore::MeasurementSet::openMrSubtable ( Subtable &  subtable,
const String subtableName 
) [inline, 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 
) [inline, 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.

Reimplemented from casacore::Table.

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

Definition at line 358 of file MeasurementSet.h.

References pointing_p.

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

Definition at line 341 of file MeasurementSet.h.

References pointing_p.

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

Definition at line 359 of file MeasurementSet.h.

References polarization_p.

MSPolarization& casacore::MeasurementSet::polarization (  )  [inline]

Definition at line 342 of file MeasurementSet.h.

References polarization_p.

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

Definition at line 360 of file MeasurementSet.h.

References processor_p.

MSProcessor& casacore::MeasurementSet::processor (  )  [inline]

Definition at line 343 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.

Reimplemented from casacore::MSTable< MSMainEnums::PredefinedColumns, MSMainEnums::PredefinedKeywords >.

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

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

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

Definition at line 361 of file MeasurementSet.h.

References source_p.

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

Definition at line 344 of file MeasurementSet.h.

References source_p.

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

Definition at line 362 of file MeasurementSet.h.

References spectralWindow_p.

MSSpectralWindow& casacore::MeasurementSet::spectralWindow (  )  [inline]

Definition at line 345 of file MeasurementSet.h.

References spectralWindow_p.

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

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

Definition at line 363 of file MeasurementSet.h.

References state_p.

MSState& casacore::MeasurementSet::state (  )  [inline]

Definition at line 346 of file MeasurementSet.h.

References state_p.

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

Definition at line 364 of file MeasurementSet.h.

References sysCal_p.

MSSysCal& casacore::MeasurementSet::sysCal (  )  [inline]

Definition at line 347 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.

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

Definition at line 365 of file MeasurementSet.h.

References weather_p.

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

Definition at line 348 of file MeasurementSet.h.

References weather_p.

String casacore::MeasurementSet::weatherTableName (  )  const

Member Data Documentation

keep references to the subtables

Definition at line 456 of file MeasurementSet.h.

Referenced by antenna().

Definition at line 457 of file MeasurementSet.h.

Referenced by dataDescription().

Definition at line 474 of file MeasurementSet.h.

Definition at line 458 of file MeasurementSet.h.

Referenced by doppler().

Definition at line 459 of file MeasurementSet.h.

Referenced by feed().

Definition at line 460 of file MeasurementSet.h.

Referenced by field().

Definition at line 461 of file MeasurementSet.h.

Referenced by flagCmd().

Definition at line 462 of file MeasurementSet.h.

Referenced by freqOffset().

Definition at line 476 of file MeasurementSet.h.

Definition at line 463 of file MeasurementSet.h.

Referenced by history().

Definition at line 477 of file MeasurementSet.h.

Definition at line 478 of file MeasurementSet.h.

Definition at line 475 of file MeasurementSet.h.

Definition at line 479 of file MeasurementSet.h.

Definition at line 464 of file MeasurementSet.h.

Referenced by observation().

Definition at line 465 of file MeasurementSet.h.

Referenced by pointing().

Definition at line 466 of file MeasurementSet.h.

Referenced by polarization().

Definition at line 467 of file MeasurementSet.h.

Referenced by processor().

Definition at line 468 of file MeasurementSet.h.

Referenced by source().

Definition at line 469 of file MeasurementSet.h.

Referenced by spectralWindow().

Definition at line 470 of file MeasurementSet.h.

Referenced by state().

Definition at line 471 of file MeasurementSet.h.

Referenced by sysCal().

Definition at line 472 of file MeasurementSet.h.

Referenced by weather().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1