26#ifndef MS_MSSELECTION_H 
   27#define MS_MSSELECTION_H 
   29#include <casacore/casa/aips.h> 
   30#include <casacore/casa/BasicSL/String.h> 
   31#include <casacore/casa/Arrays/Vector.h> 
   32#include <casacore/measures/Measures/MEpoch.h> 
   33#include <casacore/measures/Measures/MRadialVelocity.h> 
   34#include <casacore/tables/TaQL/ExprNode.h> 
   35#include <casacore/ms/MeasurementSets/MeasurementSet.h> 
   36#include <casacore/casa/Arrays/Matrix.h> 
   37#include <casacore/casa/Arrays/Cube.h> 
   38#include <casacore/ms/MSSel/MSSelectionError.h> 
   39#include <casacore/ms/MSSel/MSSelectionErrorHandler.h> 
   40#include <casacore/ms/MSSel/MSSelectableTable.h> 
  145        const String& timeExpr=
"",
 
  146        const String& antennaExpr=
"",
 
  147        const String& fieldExpr=
"",
 
  149        const String& uvDistExpr=
"",
 
  150        const String& taqlExpr=
"",
 
  151        const String& polnExpr=
"",
 
  152        const String& scanExpr=
"",
 
  153        const String& arrayExpr=
"",
 
  154        const String& stateExpr=
"",
 
  155        const String& observationExpr=
"",
 
  156        const String& feedExpr=
"");
 
  303                const Int defaultStep=1,
 
  429               const Int defaultChanStep=1);
 
  476               const String& outMSName=
"");
 
  500           const String& timeExpr        = 
"",
 
  501           const String& antennaExpr     = 
"",
 
  502           const String& fieldExpr       = 
"",
 
  503           const String& spwExpr         = 
"",
 
  504           const String& uvDistExpr      = 
"",
 
  505           const String& taqlExpr        = 
"",
 
  506           const String& polnExpr        = 
"",
 
  507           const String& scanExpr        = 
"",
 
  508           const String& arrayExpr       = 
"",
 
  509           const String& stateExpr       = 
"",
 
  510           const String& observationExpr = 
"");
 
  515           const String& timeExpr        = 
"",
 
  516           const String& antennaExpr     = 
"",
 
  517           const String& fieldExpr       = 
"",
 
  518           const String& spwExpr         = 
"",
 
  519           const String& uvDistExpr      = 
"",
 
  520           const String& taqlExpr        = 
"",
 
  521           const String& polnExpr        = 
"",
 
  522           const String& scanExpr        = 
"",
 
  523           const String& arrayExpr       = 
"",
 
  524           const String& stateExpr       = 
"",
 
  525           const String& observationExpr = 
"",
 
  526           const String& feedExpr        = 
"");
 
  534           const String& timeExpr        = 
"",
 
  535           const String& antennaExpr     = 
"",
 
  536           const String& fieldExpr       = 
"",
 
  537           const String& spwExpr         = 
"",
 
  538           const String& uvDistExpr      = 
"",
 
  539           const String& taqlExpr        = 
"",
 
  540           const String& polnExpr        = 
"",
 
  541           const String& scanExpr        = 
"",
 
  542           const String& arrayExpr       = 
"",
 
  543           const String& stateExpr       = 
"",
 
  544           const String& observationExpr = 
"");
 
  549           const String& timeExpr        = 
"",
 
  550           const String& antennaExpr     = 
"",
 
  551           const String& fieldExpr       = 
"",
 
  552           const String& spwExpr         = 
"",
 
  553           const String& uvDistExpr      = 
"",
 
  554           const String& taqlExpr        = 
"",
 
  555           const String& polnExpr        = 
"",
 
  556           const String& scanExpr        = 
"",
 
  557           const String& arrayExpr       = 
"",
 
  558           const String& stateExpr       = 
"",
 
  559           const String& observationExpr = 
"",
 
  560           const String& feedExpr        = 
"");
 
 
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
 
Matrix< Double > selectedUVRange_p
 
Matrix< Int > baselineIDs_p
 
const MeasurementSet * ms_p
 
void fromSelectionItem(const Record &selectionItem)
Initialize from a Record representing a selection item from the user interface or CLI.
 
void resetMS(const MeasurementSet &ms)
 
Vector< Int > observationIDs_p
 
Vector< Int > antenna2IDs_p
 
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.
 
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 dire...
 
Bool setAntennaExpr(const String &antennaExpr)
Expression setters.
 
Vector< Int > getObservationList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected observation IDs.
 
Bool setScanExpr(const String &scanExpr)
 
Bool setFieldExpr(const String &fieldExpr)
 
TableExprNode getTEN(const MeasurementSet *ms=NULL)
Accessor for result of parsing all of the selection expressions.
 
MSSelection()
Default null constructor, and destructor.
 
Matrix< Double > getTimeList(const MeasurementSet *ms=NULL)
Accessor for the list of the specified time range(s) as the start and end MJD values.
 
const String getExpr(const MSExprType type=NO_EXPR)
Accessor for the various selection expressions as strings.
 
Bool setStateExpr(const String &stateExpr)
 
Matrix< Int > 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 se...
 
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).
 
Vector< Int > getScanList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected scan IDs.
 
Vector< Int > getStateObsModeList(const MeasurementSet *ms=NULL)
Accessor for the list of selected state Obs_Modes.
 
Bool setTimeExpr(const String &timeExpr)
 
Vector< Int > getAntenna1List(const MeasurementSet *ms=NULL)
Accessor for the list of antenna-1 of the selected baselines.
 
void deleteErrorHandlers()
Delete error handlers (mostly the internally allocated ones).
 
Bool definedAndSet(const Record &inpRec, const String &fieldName)
Check if record field exists and is not unset.
 
Bool getSelectedMS(MeasurementSet &selectedMS, const String &outMSName="")
Return the selected MS.
 
void initErrorHandler(const MSExprType tye=NO_EXPR)
Initialize the error handler.
 
void clear(const MSExprType type=NO_EXPR)
Clear sub-expression and reset priority.
 
Vector< Int > getFeed2List(const MeasurementSet *ms=NULL)
Accessor for the list of the selected feed2 IDs.
 
void deleteNodes()
Convey to the various parsers to delete the TENs they hold.
 
Matrix< Double > getUVList(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 M...
 
Bool setPolnExpr(const String &polnExpr)
 
Vector< Int > getFieldList(const MeasurementSet *ms=NULL)
Accessor for the list of selected field IDs.
 
MSSelection & operator=(const MSSelection &other)
Assignment operator.
 
Bool setArrayExpr(const String &ArrayExpr)
 
void setMaxObs(const Int &n=1000)
 
void setMaxScans(const Int &n=1000)
Set the maximum value acceptable for SCAN, OBSERVATION or SUB-ARRAY IDs.
 
Bool setFeedExpr(const String &feedExpr)
 
Bool exprIsNull(const MSExprType type=NO_EXPR)
 
std::map< Int, Vector< Vector< Int > > > selectedSetupMap_p
 
Bool setOrder(MSSelection::MSExprType type)
Set into the order of the selection expression.
 
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.
 
Vector< Int > getFeed1List(const MeasurementSet *ms=NULL)
Accessor for the list of the selected feed1 IDs.
 
TableExprNode toTableExprNode(const MeasurementSet *ms)
Convert to TableExprNode format (C++ interface to TaQL).
 
MSSelection(const MSSelection &other)
Copy constructor.
 
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.
 
TableExprNode fullTEN_p
Convert an MS select string to TaQL const String msToTaQL(const String& msSelect) {};.
 
Vector< Int > getSubArrayList(const MeasurementSet *ms=NULL)
Accessor for the list of selected sub-array IDs.
 
void clearErrorHandlers()
Set all error handlers to a known state (NULL).
 
Matrix< Double > selectedTimesList_p
 
Vector< Int > getAntenna2List(const MeasurementSet *ms=NULL)
Accessor for the list of antenna-2 of the selected baselines.
 
const MeasurementSet * getMS(MSSelectableTable *msLike)
Return the pointer to the MS used internally.
 
void setMaxArray(const Int &n=1000)
 
std::map< Int, Vector< Vector< Int > > > getCorrMap(const MeasurementSet *ms=NULL)
The key in the ordered map returned by getCorrMap() is the pol.
 
Matrix< Int > getBaselineList(const MeasurementSet *ms=NULL)
Accessor for the list of selected baselines.
 
Bool setObservationExpr(const String &observationExpr)
 
Bool setTaQLExpr(const String &taqlExpr)
 
Vector< Bool > selectedUVUnits_p
 
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.
 
String antennaExpr_p
Selection expressions.
 
static String nameExprStr(Vector< String > name)
Helper method for converting name vectors to expression strings.
 
Vector< Int > antenna1IDs_p
 
Matrix< Int > feedPairIDs_p
 
void runErrorHandler()
Execute the handleError() method of the error-handlers.
 
Vector< Bool > getUVUnitsList(const MeasurementSet *ms=NULL)
Accessor for the list of user defined units for the uv-range(s).
 
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 th...
 
Vector< Int > stateObsModeIDs_p
 
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.
 
std::map< Int, Vector< Int > > selectedPolMap_p
 
void getCorrSlices(Vector< Vector< Slice > > &corrslices, const MeasurementSet *ms=NULL)
 
Bool setSpwExpr(const String &spwExpr)
 
MSSelection(const Record &selectionItem)
Construct from a record representing a selection item at the CLI or user interface level.
 
Matrix< Double > getChanFreqList(const MeasurementSet *ms=NULL, const Bool sorted=False)
Same as getChanList, except that the channels and steps are in Hz.
 
Vector< Int > getDDIDList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Data Description IDs (DDID) from the polarization expression pa...
 
TableExprNode toTableExprNode(MSSelectableTable *msLike)
Convert to TableExprNode format (C++ interface to TaQL).
 
Vector< Int > getSPWDDIDList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Data Description IDs from the SPW expression parsing.
 
static String indexExprStr(Vector< Int > index)
Helper method for converting index vectors to expression strings.
 
Vector< Int > getSpwList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Spectral Window IDs.
 
Bool setUvDistExpr(const String &uvDistExpr)
 
Vector< Int > exprOrder_p
Priority.
 
Matrix< Int > getFeedPairList(const MeasurementSet *ms=NULL)
Similar to baselines for antennas.
 
String: the storage and methods of handling collections of characters.
 
this file contains all the compiler specific defines
 
bool Bool
Define the standard types used by Casacore.