casacore
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::MSSelection Class Reference

More...

#include <MSSelection.h>

Public Types

enum  MSExprType {
  NO_EXPR ,
  ANTENNA_EXPR ,
  CORR_EXPR ,
  FIELD_EXPR ,
  SPW_EXPR ,
  SCAN_EXPR ,
  ARRAY_EXPR ,
  TIME_EXPR ,
  UVDIST_EXPR ,
  POLN_EXPR ,
  STATE_EXPR ,
  OBSERVATION_EXPR ,
  FEED_EXPR ,
  TAQL_EXPR ,
  MAX_EXPR
}
 
enum  MSSMode {
  PARSE_NOW ,
  PARSE_LATE
}
 

Public Member Functions

 MSSelection ()
 Default null constructor, and destructor. More...
 
virtual ~MSSelection ()
 
 MSSelection (const MeasurementSet &ms, const MSSMode &mode=PARSE_NOW, const String &timeExpr="", const String &antennaExpr="", const String &fieldExpr="", const String &spwExpr="", const String &uvDistExpr="", const String &taqlExpr="", const String &polnExpr="", const String &scanExpr="", const String &arrayExpr="", const String &stateExpr="", const String &observationExpr="", const String &feedExpr="")
 Construct using an MS and the various selection expressions to be applied to the given MS. More...
 
 MSSelection (const Record &selectionItem)
 Construct from a record representing a selection item at the CLI or user interface level. More...
 
 MSSelection (const MSSelection &other)
 Copy constructor. More...
 
MSSelectionoperator= (const MSSelection &other)
 Assignment operator. More...
 
Bool setAntennaExpr (const String &antennaExpr)
 Expression setters. More...
 
Bool setFieldExpr (const String &fieldExpr)
 
Bool setSpwExpr (const String &spwExpr)
 
Bool setScanExpr (const String &scanExpr)
 
Bool setArrayExpr (const String &ArrayExpr)
 
Bool setTimeExpr (const String &timeExpr)
 
Bool setUvDistExpr (const String &uvDistExpr)
 
Bool setTaQLExpr (const String &taqlExpr)
 
Bool setPolnExpr (const String &polnExpr)
 
Bool setStateExpr (const String &stateExpr)
 
Bool setObservationExpr (const String &observationExpr)
 
Bool setFeedExpr (const String &feedExpr)
 
const String getExpr (const MSExprType type=NO_EXPR)
 Accessor for the various selection expressions as strings. More...
 
TableExprNode getTEN (const MeasurementSet *ms=NULL)
 Accessor for result of parsing all of the selection expressions. More...
 
Vector< IntgetScanList (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected scan IDs. More...
 
Vector< IntgetObservationList (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected observation IDs. More...
 
Vector< IntgetFeed1List (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected feed1 IDs. More...
 
Vector< IntgetFeed2List (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected feed2 IDs. More...
 
Matrix< IntgetFeedPairList (const MeasurementSet *ms=NULL)
 Similar to baselines for antennas. More...
 
Vector< IntgetSubArrayList (const MeasurementSet *ms=NULL)
 Accessor for the list of selected sub-array IDs. More...
 
Vector< IntgetAntenna1List (const MeasurementSet *ms=NULL)
 Accessor for the list of antenna-1 of the selected baselines. More...
 
Vector< IntgetAntenna2List (const MeasurementSet *ms=NULL)
 Accessor for the list of antenna-2 of the selected baselines. More...
 
Matrix< IntgetBaselineList (const MeasurementSet *ms=NULL)
 Accessor for the list of selected baselines. More...
 
Vector< IntgetFieldList (const MeasurementSet *ms=NULL)
 Accessor for the list of selected field IDs. More...
 
Vector< IntgetStateObsModeList (const MeasurementSet *ms=NULL)
 Accessor for the list of selected state Obs_Modes. More...
 
Matrix< DoublegetTimeList (const MeasurementSet *ms=NULL)
 Accessor for the list of the specified time range(s) as the start and end MJD values. More...
 
Matrix< DoublegetUVList (const MeasurementSet *ms=NULL)
 Accessor for the list of the specified uv-range(s) as the start and end values in units used in the MS. More...
 
Vector< BoolgetUVUnitsList (const MeasurementSet *ms=NULL)
 Accessor for the list of user defined units for the uv-range(s). More...
 
Vector< IntgetSpwList (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected Spectral Window IDs. More...
 
Matrix< IntgetChanList (const MeasurementSet *ms=NULL, const Int defaultStep=1, const Bool sorted=False)
 Accessor for the table (as a nx4 Matrix) of the selected Spectral Windows and associated ranges of selected channels. More...
 
Matrix< DoublegetChanFreqList (const MeasurementSet *ms=NULL, const Bool sorted=False)
 Same as getChanList, except that the channels and steps are in Hz. More...
 
Vector< IntgetDDIDList (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected Data Description IDs (DDID) from the polarization expression parsing. More...
 
Vector< IntgetSPWDDIDList (const MeasurementSet *ms=NULL)
 Accessor for the list of the selected Data Description IDs from the SPW expression parsing. More...
 
std::map< Int, Vector< Int > > getPolMap (const MeasurementSet *ms=NULL)
 The key in the ordered map returned by getPolMap() is the Data Description ID (DDID). More...
 
std::map< Int, Vector< Vector< Int > > > getCorrMap (const MeasurementSet *ms=NULL)
 The key in the ordered map returned by getCorrMap() is the pol. More...
 
void getChanSlices (Vector< Vector< Slice > > &chanslices, const MeasurementSet *ms=NULL, const Int defaultChanStep=1)
 Methods to convert the maps return by getChanList and getCorrMap to a list of Slice which can be directly used by Table system for in-row selection of frequency channels and polarizations. More...
 
void getCorrSlices (Vector< Vector< Slice > > &corrslices, const MeasurementSet *ms=NULL)
 
void clear (const MSExprType type=NO_EXPR)
 Clear sub-expression and reset priority. More...
 
void clearErrorHandlers ()
 Set all error handlers to a known state (NULL). More...
 
Bool exprIsNull (const MSExprType type=NO_EXPR)
 
void deleteNodes ()
 Convey to the various parsers to delete the TENs they hold. More...
 
void deleteErrorHandlers ()
 Delete error handlers (mostly the internally allocated ones). More...
 
TableExprNode toTableExprNode (const MeasurementSet *ms)
 Convert to TableExprNode format (C++ interface to TaQL). More...
 
TableExprNode toTableExprNode (MSSelectableTable *msLike)
 Convert to TableExprNode format (C++ interface to TaQL). More...
 
Bool getSelectedMS (MeasurementSet &selectedMS, const String &outMSName="")
 Return the selected MS. More...
 
void resetMS (const MeasurementSet &ms)
 
void resetTEN ()
 
void reset (const MeasurementSet &ms, const MSSMode &mode=PARSE_NOW, const String &timeExpr="", const String &antennaExpr="", const String &fieldExpr="", const String &spwExpr="", const String &uvDistExpr="", const String &taqlExpr="", const String &polnExpr="", const String &scanExpr="", const String &arrayExpr="", const String &stateExpr="", const String &observationExpr="")
 The MSSelection object is designed to be re-usable object. More...
 
void reset2 (const MeasurementSet &ms, const MSSMode &mode=PARSE_NOW, const String &timeExpr="", const String &antennaExpr="", const String &fieldExpr="", const String &spwExpr="", const String &uvDistExpr="", const String &taqlExpr="", const String &polnExpr="", const String &scanExpr="", const String &arrayExpr="", const String &stateExpr="", const String &observationExpr="", const String &feedExpr="")
 Add feedExpr; keep old signature for backwards compatibility. More...
 
void reset (MSSelectableTable &msLike, const MSSMode &mode=PARSE_NOW, const String &timeExpr="", const String &antennaExpr="", const String &fieldExpr="", const String &spwExpr="", const String &uvDistExpr="", const String &taqlExpr="", const String &polnExpr="", const String &scanExpr="", const String &arrayExpr="", const String &stateExpr="", const String &observationExpr="")
 This version of reset() works with generic MSSelectableTable object. More...
 
void reset2 (MSSelectableTable &msLike, const MSSMode &mode=PARSE_NOW, const String &timeExpr="", const String &antennaExpr="", const String &fieldExpr="", const String &spwExpr="", const String &uvDistExpr="", const String &taqlExpr="", const String &polnExpr="", const String &scanExpr="", const String &arrayExpr="", const String &stateExpr="", const String &observationExpr="", const String &feedExpr="")
 Add feedExpr; keep old signature for backwards compatibility. More...
 
void setMaxScans (const Int &n=1000)
 Set the maximum value acceptable for SCAN, OBSERVATION or SUB-ARRAY IDs. More...
 
void setMaxObs (const Int &n=1000)
 
void setMaxArray (const Int &n=1000)
 
void setErrorHandler (const MSExprType type, MSSelectionErrorHandler *mssEH, const Bool overRide=True)
 Set the error handler to be used for reporting errors while parsing the type of expression give by the first argument. More...
 
void initErrorHandler (const MSExprType tye=NO_EXPR)
 Initialize the error handler. More...
 
void runErrorHandler ()
 Execute the handleError() method of the error-handlers. More...
 
const MeasurementSetgetMS (MSSelectableTable *msLike)
 Return the pointer to the MS used internally. More...
 

Static Public Member Functions

static String indexExprStr (Vector< Int > index)
 Helper method for converting index vectors to expression strings. More...
 
static String nameExprStr (Vector< String > name)
 Helper method for converting name vectors to expression strings. More...
 

Private Member Functions

Bool setOrder (MSSelection::MSExprType type)
 Set into the order of the selection expression. More...
 
void fromSelectionItem (const Record &selectionItem)
 Initialize from a Record representing a selection item from the user interface or CLI. More...
 
Bool definedAndSet (const Record &inpRec, const String &fieldName)
 Check if record field exists and is not unset. More...
 

Private Attributes

TableExprNode fullTEN_p
 Convert an MS select string to TaQL const String msToTaQL(const String& msSelect) {};. More...
 
const MeasurementSetms_p
 
String antennaExpr_p
 Selection expressions. More...
 
String fieldExpr_p
 
String spwExpr_p
 
String scanExpr_p
 
String arrayExpr_p
 
String timeExpr_p
 
String uvDistExpr_p
 
String polnExpr_p
 
String taqlExpr_p
 
String stateExpr_p
 
String observationExpr_p
 
String feedExpr_p
 
Vector< IntexprOrder_p
 Priority. More...
 
Vector< Intantenna1IDs_p
 
Vector< Intantenna2IDs_p
 
Vector< IntfieldIDs_p
 
Vector< IntspwIDs_p
 
Vector< IntscanIDs_p
 
Vector< IntarrayIDs_p
 
Vector< IntddIDs_p
 
Vector< IntstateObsModeIDs_p
 
Vector< IntobservationIDs_p
 
Vector< IntspwDDIDs_p
 
Vector< Intfeed1IDs_p
 
Vector< Intfeed2IDs_p
 
Matrix< IntchanIDs_p
 
Matrix< IntbaselineIDs_p
 
Matrix< IntfeedPairIDs_p
 
Matrix< DoubleselectedTimesList_p
 
Matrix< DoubleselectedUVRange_p
 
Vector< BoolselectedUVUnits_p
 
std::map< Int, Vector< Int > > selectedPolMap_p
 
std::map< Int, Vector< Vector< Int > > > selectedSetupMap_p
 
Int maxScans_p
 
Int maxObs_p
 
Int maxArray_p
 
Bool isMS_p
 
Bool toTENCalled_p
 

Detailed Description


MSSelection: Class to represent a selection on an MS

Intended use:

Public interface

Prerequisite

Etymology

From "MeasurementSet" and "selection".

Synopsis

The MSSelection class represents a selection on a MeasurementSet (MS). This class is used in translating MS selections represented as selection items in the user interface, and for converting between MS selection and pure TaQL selection.

The purpose of this class is to provides a simple expression based selection mechanism to both the end-user and developer wishing to perform query operations over a measurement set. This is accomplished by abstracting the TaQL interface through an adapter/translation interface which converts STaQL (Simple Table Query Language) expressions into the equivalent table expression form, reducing the knowledge necessary to perform powerful query operations directly in TaQL. It is also possible to supply pure TaQL expression(s) as sub-expressions if required. For a complete list of the STaQL interface refer to the MeasurementSet Selection Syntax document at: Data Selection

The sub-expressions are interpreted in the order which they were set. The order however in not important - any dependency on the order in which the expressions are evaluated is handled internally. The result of parsing the expressions is TableExprNode (TEN). All TENs from sub-expressions are finally ANDed and the resultant TEN is used to select the rows of the MS table.

Example

// Create a MS and a MS selection
MeasurementSet ms(msName);
MSSelection select;
// Setup any sub-expressions of interest directly
// (or optionally send this information through a Record)
select.setFieldExpr("0,1");
select.setSpwExpr(">0");
// Create a table expression over a MS representing the selection
TableExprNode node = select.toTableExprNode(&ms);
// Optionally create a table and new MS based on this node
Table tablesel(ms.tableName(), Table::Update);
MeasurementSet mssel(tablesel(node, node.nrow()));
MSSelection()
Default null constructor, and destructor.
@ Update
update existing table
Definition: Table.h:182

Motivation

This class is used by the MS access classes.

Definition at line 118 of file MSSelection.h.

Member Enumeration Documentation

◆ MSExprType

Enumerator
NO_EXPR 
ANTENNA_EXPR 
CORR_EXPR 
FIELD_EXPR 
SPW_EXPR 
SCAN_EXPR 
ARRAY_EXPR 
TIME_EXPR 
UVDIST_EXPR 
POLN_EXPR 
STATE_EXPR 
OBSERVATION_EXPR 
FEED_EXPR 
TAQL_EXPR 
MAX_EXPR 

Definition at line 121 of file MSSelection.h.

◆ MSSMode

Enumerator
PARSE_NOW 
PARSE_LATE 

Definition at line 136 of file MSSelection.h.

Constructor & Destructor Documentation

◆ MSSelection() [1/4]

casacore::MSSelection::MSSelection ( )

Default null constructor, and destructor.

◆ ~MSSelection()

virtual casacore::MSSelection::~MSSelection ( )
virtual

◆ MSSelection() [2/4]

casacore::MSSelection::MSSelection ( const MeasurementSet ms,
const MSSMode mode = PARSE_NOW,
const String timeExpr = "",
const String antennaExpr = "",
const String fieldExpr = "",
const String spwExpr = "",
const String uvDistExpr = "",
const String taqlExpr = "",
const String polnExpr = "",
const String scanExpr = "",
const String arrayExpr = "",
const String stateExpr = "",
const String observationExpr = "",
const String feedExpr = "" 
)

Construct using an MS and the various selection expressions to be applied to the given MS.

By default, the expressions will be parsed immediately. With mode=PARSE_LATE, the parsing will be done with a call to toTableExprNode().

◆ MSSelection() [3/4]

casacore::MSSelection::MSSelection ( const Record selectionItem)

Construct from a record representing a selection item at the CLI or user interface level.

This is functionally same as the constructor above with mode=PARSE_LATE.

◆ MSSelection() [4/4]

casacore::MSSelection::MSSelection ( const MSSelection other)

Copy constructor.

Member Function Documentation

◆ clear()

void casacore::MSSelection::clear ( const MSExprType  type = NO_EXPR)

Clear sub-expression and reset priority.

Default behavior is to reset all sub-expressions.

◆ clearErrorHandlers()

void casacore::MSSelection::clearErrorHandlers ( )

Set all error handlers to a known state (NULL).

◆ definedAndSet()

Bool casacore::MSSelection::definedAndSet ( const Record inpRec,
const String fieldName 
)
private

Check if record field exists and is not unset.

◆ deleteErrorHandlers()

void casacore::MSSelection::deleteErrorHandlers ( )

Delete error handlers (mostly the internally allocated ones).

◆ deleteNodes()

void casacore::MSSelection::deleteNodes ( )

Convey to the various parsers to delete the TENs they hold.

◆ exprIsNull()

Bool casacore::MSSelection::exprIsNull ( const MSExprType  type = NO_EXPR)

◆ fromSelectionItem()

void casacore::MSSelection::fromSelectionItem ( const Record selectionItem)
private

Initialize from a Record representing a selection item from the user interface or CLI.

◆ getAntenna1List()

Vector<Int> casacore::MSSelection::getAntenna1List ( const MeasurementSet ms = NULL)
inline

Accessor for the list of antenna-1 of the selected baselines.

Antennas affected by the baseline negation operator have the antenna IDs multiplied by -1.

Definition at line 229 of file MSSelection.h.

References antenna1IDs_p, and getTEN().

◆ getAntenna2List()

Vector<Int> casacore::MSSelection::getAntenna2List ( const MeasurementSet ms = NULL)
inline

Accessor for the list of antenna-2 of the selected baselines.

Antennas affected by the baseline negation operator have the antenna IDs multiplied by -1.

Definition at line 236 of file MSSelection.h.

References antenna2IDs_p, and getTEN().

◆ getBaselineList()

Matrix<Int> casacore::MSSelection::getBaselineList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of selected baselines.

The list is a Nx2 Matrix with one row per baseline containing the antenna IDs of the two antenna associated with the baseline.

Baselines affected by the negation operator in the baseline selection expression are reported with one or both the antenna IDs multiplied by -1. E.g. a baseline selection expression "!1" will result in a baseline list

[-1, 2], [-1, 3], [-1, 4], ....

The expression "!1&10" will result in a baseline list [-1, -10]. Etc...

Definition at line 257 of file MSSelection.h.

References baselineIDs_p, and getTEN().

◆ getChanFreqList()

Matrix<Double> casacore::MSSelection::getChanFreqList ( const MeasurementSet ms = NULL,
const Bool  sorted = False 
)

Same as getChanList, except that the channels and steps are in Hz.

◆ getChanList()

Matrix<Int> casacore::MSSelection::getChanList ( const MeasurementSet ms = NULL,
const Int  defaultStep = 1,
const Bool  sorted = False 
)

Accessor for the table (as a nx4 Matrix) of the selected Spectral Windows and associated ranges of selected channels.

Each row of the Matrix has the following elements:

SpwID StartCh StopCh Step

where StartCh, StopCh and Step are the first and the last selected channels and step is the step size. If no step size was supplied as part of the expression, the value of Step is replaced with the value of the defaultStep parameter. Multiple channel specifications for the same Spectral Window selection, results in multiple rows in the Matrix. If sorted is True, the rows of the output Matrix will be sorted by the SPW IDs (the entries in the first column).

◆ getChanSlices()

void casacore::MSSelection::getChanSlices ( Vector< Vector< Slice > > &  chanslices,
const MeasurementSet ms = NULL,
const Int  defaultChanStep = 1 
)

Methods to convert the maps return by getChanList and getCorrMap to a list of Slice which can be directly used by Table system for in-row selection of frequency channels and polarizations.

◆ getCorrMap()

std::map<Int, Vector<Vector<Int> > > casacore::MSSelection::getCorrMap ( const MeasurementSet ms = NULL)
inline

The key in the ordered map returned by getCorrMap() is the pol.

in the Data Description ID (DDID) sub-table. The value is a Vector of two Vectors.

The returned Map<T> has a key that maps to two vectors: Key -—> Vector1 Vector2

Key : Row index in the POLARIZATION sub-table

Vector1 : List of poln. indices selected from the row pointed by Key. These are the in-row indices to pick-out the desired (selected) polarization products from the selected rows of the MS (or equivalently, the list of indices for the vector in the corrType column of the POLARIZATION sub-table).

Vector2 : List of selected rows from the DATA_DESCRIPTION sub-table

An example: following are the sub-tables used for the example explaination below:

POLARIZATION Sub-table

Row Poln

0 RR, LL 1 RR, LR, RL, LL

DATA_DESCRIPTION Sub-table

Row PolnID SpwID

0 0 0 1 1 1 2 1 2 3 1 3 4 1 4 5 1 5 6 1 6 7 1 7 8 1 8

E.g., the expression poln='LL'

returns the Map:

corrmap = (0, [[1], [0]]) (1, [[3], [0,1,2,3,4,5,6,7,8]])

The rows from the POLARIZATION table selected are 0 and 1, These are two keys for the two entries in the map.

  1. The two vectors in map 1 are: [1] and [0]. The this reads as: From the 0th. row of the POLARIZATION table, use the indices [1]. The relevant list of associated DD rows are [0]
  2. The two vectors in map 2 are: [3] and [0,1,2,3,4,5,6,7,8]. This reads as: From the 1st. row of the POLARIZATION table, use the indices [3]. The relevant list of associated DD rows are [0,1,2,3,4,5,6,7,8].

For a client code:

o To get a list of the DDIDs selected, iterate over all entries of the map and collate the second vector from each entry.

Or, use getDDIDList().

o To get the list of the selected poln. in-row indices, collate the first vector from each entry.

o To get a list of POLARIZATION IDs selected (rows of the POLARIZATION table), make a list of all the keys of this map.

Definition at line 423 of file MSSelection.h.

References getTEN(), and selectedSetupMap_p.

◆ getCorrSlices()

void casacore::MSSelection::getCorrSlices ( Vector< Vector< Slice > > &  corrslices,
const MeasurementSet ms = NULL 
)

◆ getDDIDList()

Vector<Int> casacore::MSSelection::getDDIDList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected Data Description IDs (DDID) from the polarization expression parsing.

The actual selected DDIDs would be an intersection of the DDIDs selected from polarization and SPW expressions parsing (see getSPWDDIDList() below). Note that there is no guarantee that returned vector is inmight not be in sorted order.

Definition at line 322 of file MSSelection.h.

References ddIDs_p, getTEN(), and casacore::ArrayBase::nelements().

◆ getExpr()

const String casacore::MSSelection::getExpr ( const MSExprType  type = NO_EXPR)

Accessor for the various selection expressions as strings.

◆ getFeed1List()

Vector<Int> casacore::MSSelection::getFeed1List ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected feed1 IDs.

Definition at line 211 of file MSSelection.h.

References feed1IDs_p, and getTEN().

◆ getFeed2List()

Vector<Int> casacore::MSSelection::getFeed2List ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected feed2 IDs.

Definition at line 215 of file MSSelection.h.

References feed2IDs_p, and getTEN().

◆ getFeedPairList()

Matrix<Int> casacore::MSSelection::getFeedPairList ( const MeasurementSet ms = NULL)
inline

Similar to baselines for antennas.

Definition at line 219 of file MSSelection.h.

References feedPairIDs_p, and getTEN().

◆ getFieldList()

Vector<Int> casacore::MSSelection::getFieldList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of selected field IDs.

Definition at line 261 of file MSSelection.h.

References fieldIDs_p, and getTEN().

◆ getMS()

const MeasurementSet* casacore::MSSelection::getMS ( MSSelectableTable msLike)

Return the pointer to the MS used internally.

◆ getObservationList()

Vector<Int> casacore::MSSelection::getObservationList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected observation IDs.

Definition at line 207 of file MSSelection.h.

References getTEN(), and observationIDs_p.

◆ getPolMap()

std::map<Int, Vector<Int> > casacore::MSSelection::getPolMap ( const MeasurementSet ms = NULL)
inline

The key in the ordered map returned by getPolMap() is the Data Description ID (DDID).

The value is a vector containing the list of in-row indices to pick out the selected polarizations (or equivalently, the list of indices for the vector in the corrType column of the POLARIZATION sub-table). These are also what the user intended (i.e., e.g. not all DD IDs due to user POL expression might be selected due to SPW expressions).

Definition at line 347 of file MSSelection.h.

References getTEN(), and selectedPolMap_p.

◆ getScanList()

Vector<Int> casacore::MSSelection::getScanList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected scan IDs.

Definition at line 203 of file MSSelection.h.

References getTEN(), and scanIDs_p.

◆ getSelectedMS()

Bool casacore::MSSelection::getSelectedMS ( MeasurementSet selectedMS,
const String outMSName = "" 
)

Return the selected MS.

The selected MS reflects only row selections (as against in-row selections). If outMSName != "", the selected MS is also written to the disk (a shallow copy).

For in-row selection, use the appropriate global function mssSetData() MSSelectionTools.h which also returns the in-row (corr/chan) slices that can be supplied to the VisIter object for on-the-fly in-row selection.

◆ getSPWDDIDList()

Vector<Int> casacore::MSSelection::getSPWDDIDList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected Data Description IDs from the SPW expression parsing.

The actual selected DDIDs would be an intersection of the DDIDs selected from polarization and SPW expressions parsing (see getDDIDList() above).

The actual DDIDs selected will be an intersection of the lists from getDDIDList() and getSPWDDIDList() (which can be generated using the set_intersection(Vector<Int>&, Vector<Int>&) global method in MSSelectionTool.{cc,h}).

Definition at line 335 of file MSSelection.h.

References getTEN(), casacore::ArrayBase::nelements(), and spwDDIDs_p.

◆ getSpwList()

Vector<Int> casacore::MSSelection::getSpwList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the selected Spectral Window IDs.

Definition at line 287 of file MSSelection.h.

References getTEN(), and spwIDs_p.

◆ getStateObsModeList()

Vector<Int> casacore::MSSelection::getStateObsModeList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of selected state Obs_Modes.

Definition at line 266 of file MSSelection.h.

References getTEN(), casacore::ArrayBase::nelements(), and stateObsModeIDs_p.

◆ getSubArrayList()

Vector<Int> casacore::MSSelection::getSubArrayList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of selected sub-array IDs.

Definition at line 223 of file MSSelection.h.

References arrayIDs_p, and getTEN().

◆ getTEN()

TableExprNode casacore::MSSelection::getTEN ( const MeasurementSet ms = NULL)

Accessor for result of parsing all of the selection expressions.

The final TableExprNode (TEN) is the result of ANDing the TENs for the individual expressions.

Referenced by getAntenna1List(), getAntenna2List(), getBaselineList(), getCorrMap(), getDDIDList(), getFeed1List(), getFeed2List(), getFeedPairList(), getFieldList(), getObservationList(), getPolMap(), getScanList(), getSPWDDIDList(), getSpwList(), getStateObsModeList(), getSubArrayList(), getTimeList(), getUVList(), and getUVUnitsList().

◆ getTimeList()

Matrix<Double> casacore::MSSelection::getTimeList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the specified time range(s) as the start and end MJD values.

The time ranges are stored as columns, i.e. the output Matrix is 2 x n_ranges.

Definition at line 272 of file MSSelection.h.

References getTEN(), and selectedTimesList_p.

◆ getUVList()

Matrix<Double> casacore::MSSelection::getUVList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of the specified uv-range(s) as the start and end values in units used in the MS.

Definition at line 277 of file MSSelection.h.

References getTEN(), and selectedUVRange_p.

◆ getUVUnitsList()

Vector<Bool> casacore::MSSelection::getUVUnitsList ( const MeasurementSet ms = NULL)
inline

Accessor for the list of user defined units for the uv-range(s).

The uv-range(s) return by getUVList is always in the units used in the MS.

Definition at line 283 of file MSSelection.h.

References getTEN(), and selectedUVUnits_p.

◆ indexExprStr()

static String casacore::MSSelection::indexExprStr ( Vector< Int index)
static

Helper method for converting index vectors to expression strings.

◆ initErrorHandler()

void casacore::MSSelection::initErrorHandler ( const MSExprType  tye = NO_EXPR)

Initialize the error handler.

This is set the error-handler to the user supplied error handler via setErrorHandler() or to the default built-in error handler.

◆ nameExprStr()

static String casacore::MSSelection::nameExprStr ( Vector< String name)
static

Helper method for converting name vectors to expression strings.

◆ operator=()

MSSelection& casacore::MSSelection::operator= ( const MSSelection other)

Assignment operator.

◆ reset() [1/2]

void casacore::MSSelection::reset ( const MeasurementSet ms,
const MSSMode mode = PARSE_NOW,
const String timeExpr = "",
const String antennaExpr = "",
const String fieldExpr = "",
const String spwExpr = "",
const String uvDistExpr = "",
const String taqlExpr = "",
const String polnExpr = "",
const String scanExpr = "",
const String arrayExpr = "",
const String stateExpr = "",
const String observationExpr = "" 
)

The MSSelection object is designed to be re-usable object.

The following reset() methods set the internal state of the object to same state as with the equivalent constructor.

mode can be one of the MSSModes. MSSMode::PARSE_NOW will parse the given expressions and internally hold the final TEN (i.e. will also internally call toTableExprNode()). The internal TEN can be accessed via the getTEN() method. MSSMode::PARSE_LATER will only set the expression strings. Parsing will be done later with a call to toTableExprNode().

This version, here for backward compatibility reasons, internally constructs a MSSelectableTable object and calls the reset() method below that works with MSSelectableTable.

◆ reset() [2/2]

void casacore::MSSelection::reset ( MSSelectableTable msLike,
const MSSMode mode = PARSE_NOW,
const String timeExpr = "",
const String antennaExpr = "",
const String fieldExpr = "",
const String spwExpr = "",
const String uvDistExpr = "",
const String taqlExpr = "",
const String polnExpr = "",
const String scanExpr = "",
const String arrayExpr = "",
const String stateExpr = "",
const String observationExpr = "" 
)

This version of reset() works with generic MSSelectableTable object.

Accessing the services of the MSSelection module via this interface is recommended over the version of reset() that uses MeasurementSet.

◆ reset2() [1/2]

void casacore::MSSelection::reset2 ( const MeasurementSet ms,
const MSSMode mode = PARSE_NOW,
const String timeExpr = "",
const String antennaExpr = "",
const String fieldExpr = "",
const String spwExpr = "",
const String uvDistExpr = "",
const String taqlExpr = "",
const String polnExpr = "",
const String scanExpr = "",
const String arrayExpr = "",
const String stateExpr = "",
const String observationExpr = "",
const String feedExpr = "" 
)

Add feedExpr; keep old signature for backwards compatibility.

◆ reset2() [2/2]

void casacore::MSSelection::reset2 ( MSSelectableTable msLike,
const MSSMode mode = PARSE_NOW,
const String timeExpr = "",
const String antennaExpr = "",
const String fieldExpr = "",
const String spwExpr = "",
const String uvDistExpr = "",
const String taqlExpr = "",
const String polnExpr = "",
const String scanExpr = "",
const String arrayExpr = "",
const String stateExpr = "",
const String observationExpr = "",
const String feedExpr = "" 
)

Add feedExpr; keep old signature for backwards compatibility.

◆ resetMS()

void casacore::MSSelection::resetMS ( const MeasurementSet ms)
inline

Definition at line 481 of file MSSelection.h.

References ms_p, and resetTEN().

◆ resetTEN()

void casacore::MSSelection::resetTEN ( )
inline

Definition at line 482 of file MSSelection.h.

References fullTEN_p.

Referenced by resetMS().

◆ runErrorHandler()

void casacore::MSSelection::runErrorHandler ( )

Execute the handleError() method of the error-handlers.

This is called in the catch code for any exceptions emitted from any of the parsers. It is also called at the end of the parsing cycle.

◆ setAntennaExpr()

Bool casacore::MSSelection::setAntennaExpr ( const String antennaExpr)

Expression setters.

The following set*Expr() methods only set the expressions. Parsing is done with a call to toTableExprNode().

◆ setArrayExpr()

Bool casacore::MSSelection::setArrayExpr ( const String ArrayExpr)

◆ setErrorHandler()

void casacore::MSSelection::setErrorHandler ( const MSExprType  type,
MSSelectionErrorHandler mssEH,
const Bool  overRide = True 
)

Set the error handler to be used for reporting errors while parsing the type of expression give by the first argument.

◆ setFeedExpr()

Bool casacore::MSSelection::setFeedExpr ( const String feedExpr)

◆ setFieldExpr()

Bool casacore::MSSelection::setFieldExpr ( const String fieldExpr)

◆ setMaxArray()

void casacore::MSSelection::setMaxArray ( const Int n = 1000)
inline

Definition at line 574 of file MSSelection.h.

References maxArray_p.

◆ setMaxObs()

void casacore::MSSelection::setMaxObs ( const Int n = 1000)
inline

Definition at line 573 of file MSSelection.h.

References maxObs_p.

◆ setMaxScans()

void casacore::MSSelection::setMaxScans ( const Int n = 1000)
inline

Set the maximum value acceptable for SCAN, OBSERVATION or SUB-ARRAY IDs.

The main-table columns for these do not refere to rows of sub-tables and therefore there is no cheap way to find a valid range for these which can be used in the parsers to generate error or warning messages if a value outside the range is used in the expressions. The default maximum value for scan, observation and sub-array IDs is 1000.

Definition at line 572 of file MSSelection.h.

References maxScans_p.

◆ setObservationExpr()

Bool casacore::MSSelection::setObservationExpr ( const String observationExpr)

◆ setOrder()

Bool casacore::MSSelection::setOrder ( MSSelection::MSExprType  type)
private

Set into the order of the selection expression.

◆ setPolnExpr()

Bool casacore::MSSelection::setPolnExpr ( const String polnExpr)

◆ setScanExpr()

Bool casacore::MSSelection::setScanExpr ( const String scanExpr)

◆ setSpwExpr()

Bool casacore::MSSelection::setSpwExpr ( const String spwExpr)

◆ setStateExpr()

Bool casacore::MSSelection::setStateExpr ( const String stateExpr)

◆ setTaQLExpr()

Bool casacore::MSSelection::setTaQLExpr ( const String taqlExpr)

◆ setTimeExpr()

Bool casacore::MSSelection::setTimeExpr ( const String timeExpr)

◆ setUvDistExpr()

Bool casacore::MSSelection::setUvDistExpr ( const String uvDistExpr)

◆ toTableExprNode() [1/2]

TableExprNode casacore::MSSelection::toTableExprNode ( const MeasurementSet ms)

Convert to TableExprNode format (C++ interface to TaQL).

This is now for purely backwards compatibility and ease of use. It internally constructs the MSSelectableTable from the supplied MS and calls the generic version of toTableExprNode below (which works with MSSelectableTable object).

◆ toTableExprNode() [2/2]

TableExprNode casacore::MSSelection::toTableExprNode ( MSSelectableTable msLike)

Convert to TableExprNode format (C++ interface to TaQL).

The MSSelectableTable is a pure-virtual base class which provides a generic interface both to MeasurementSet and CalTable (in the synthesis module) services used in MSSelection. The actual objects used for supplying MeasurementSet or CalTable to MSSelection are MSInterface and CTInterface classes respectively. With this, MSSelection module can be used for selection on MeasurementSet or CalTable.

Member Data Documentation

◆ antenna1IDs_p

Vector<Int> casacore::MSSelection::antenna1IDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getAntenna1List().

◆ antenna2IDs_p

Vector<Int> casacore::MSSelection::antenna2IDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getAntenna2List().

◆ antennaExpr_p

String casacore::MSSelection::antennaExpr_p
private

Selection expressions.

Definition at line 612 of file MSSelection.h.

◆ arrayExpr_p

String casacore::MSSelection::arrayExpr_p
private

Definition at line 616 of file MSSelection.h.

◆ arrayIDs_p

Vector<Int> casacore::MSSelection::arrayIDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getSubArrayList().

◆ baselineIDs_p

Matrix<Int> casacore::MSSelection::baselineIDs_p
private

Definition at line 629 of file MSSelection.h.

Referenced by getBaselineList().

◆ chanIDs_p

Matrix<Int> casacore::MSSelection::chanIDs_p
private

Definition at line 628 of file MSSelection.h.

◆ ddIDs_p

Vector<Int> casacore::MSSelection::ddIDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getDDIDList().

◆ exprOrder_p

Vector<Int> casacore::MSSelection::exprOrder_p
private

Priority.

Definition at line 625 of file MSSelection.h.

◆ feed1IDs_p

Vector<Int> casacore::MSSelection::feed1IDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getFeed1List().

◆ feed2IDs_p

Vector<Int> casacore::MSSelection::feed2IDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getFeed2List().

◆ feedExpr_p

String casacore::MSSelection::feedExpr_p
private

Definition at line 623 of file MSSelection.h.

◆ feedPairIDs_p

Matrix<Int> casacore::MSSelection::feedPairIDs_p
private

Definition at line 630 of file MSSelection.h.

Referenced by getFeedPairList().

◆ fieldExpr_p

String casacore::MSSelection::fieldExpr_p
private

Definition at line 613 of file MSSelection.h.

◆ fieldIDs_p

Vector<Int> casacore::MSSelection::fieldIDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getFieldList().

◆ fullTEN_p

TableExprNode casacore::MSSelection::fullTEN_p
private

Convert an MS select string to TaQL const String msToTaQL(const String& msSelect) {};.

Definition at line 609 of file MSSelection.h.

Referenced by resetTEN().

◆ isMS_p

Bool casacore::MSSelection::isMS_p
private

Definition at line 637 of file MSSelection.h.

◆ maxArray_p

Int casacore::MSSelection::maxArray_p
private

Definition at line 636 of file MSSelection.h.

Referenced by setMaxArray().

◆ maxObs_p

Int casacore::MSSelection::maxObs_p
private

Definition at line 636 of file MSSelection.h.

Referenced by setMaxObs().

◆ maxScans_p

Int casacore::MSSelection::maxScans_p
private

Definition at line 636 of file MSSelection.h.

Referenced by setMaxScans().

◆ ms_p

const MeasurementSet* casacore::MSSelection::ms_p
private

Definition at line 610 of file MSSelection.h.

Referenced by resetMS().

◆ observationExpr_p

String casacore::MSSelection::observationExpr_p
private

Definition at line 622 of file MSSelection.h.

◆ observationIDs_p

Vector<Int> casacore::MSSelection::observationIDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getObservationList().

◆ polnExpr_p

String casacore::MSSelection::polnExpr_p
private

Definition at line 619 of file MSSelection.h.

◆ scanExpr_p

String casacore::MSSelection::scanExpr_p
private

Definition at line 615 of file MSSelection.h.

◆ scanIDs_p

Vector<Int> casacore::MSSelection::scanIDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getScanList().

◆ selectedPolMap_p

std::map<Int, Vector<Int> > casacore::MSSelection::selectedPolMap_p
private

Definition at line 634 of file MSSelection.h.

Referenced by getPolMap().

◆ selectedSetupMap_p

std::map<Int, Vector<Vector<Int> > > casacore::MSSelection::selectedSetupMap_p
private

Definition at line 635 of file MSSelection.h.

Referenced by getCorrMap().

◆ selectedTimesList_p

Matrix<Double> casacore::MSSelection::selectedTimesList_p
private

Definition at line 631 of file MSSelection.h.

Referenced by getTimeList().

◆ selectedUVRange_p

Matrix<Double> casacore::MSSelection::selectedUVRange_p
private

Definition at line 632 of file MSSelection.h.

Referenced by getUVList().

◆ selectedUVUnits_p

Vector<Bool> casacore::MSSelection::selectedUVUnits_p
private

Definition at line 633 of file MSSelection.h.

Referenced by getUVUnitsList().

◆ spwDDIDs_p

Vector<Int> casacore::MSSelection::spwDDIDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getSPWDDIDList().

◆ spwExpr_p

String casacore::MSSelection::spwExpr_p
private

Definition at line 614 of file MSSelection.h.

◆ spwIDs_p

Vector<Int> casacore::MSSelection::spwIDs_p
private

Definition at line 626 of file MSSelection.h.

Referenced by getSpwList().

◆ stateExpr_p

String casacore::MSSelection::stateExpr_p
private

Definition at line 621 of file MSSelection.h.

◆ stateObsModeIDs_p

Vector<Int> casacore::MSSelection::stateObsModeIDs_p
private

Definition at line 627 of file MSSelection.h.

Referenced by getStateObsModeList().

◆ taqlExpr_p

String casacore::MSSelection::taqlExpr_p
private

Definition at line 620 of file MSSelection.h.

◆ timeExpr_p

String casacore::MSSelection::timeExpr_p
private

Definition at line 617 of file MSSelection.h.

◆ toTENCalled_p

Bool casacore::MSSelection::toTENCalled_p
private

Definition at line 637 of file MSSelection.h.

◆ uvDistExpr_p

String casacore::MSSelection::uvDistExpr_p
private

Definition at line 618 of file MSSelection.h.


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