29 #ifndef MS_MSSELECTION_H
30 #define MS_MSSELECTION_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/BasicSL/String.h>
34 #include <casacore/casa/Arrays/Vector.h>
35 #include <casacore/measures/Measures/MEpoch.h>
36 #include <casacore/measures/Measures/MRadialVelocity.h>
37 #include <casacore/tables/TaQL/ExprNode.h>
38 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
39 #include <casacore/casa/Arrays/Matrix.h>
40 #include <casacore/casa/Arrays/Cube.h>
41 #include <casacore/ms/MSSel/MSSelectionError.h>
42 #include <casacore/ms/MSSel/MSSelectionErrorHandler.h>
43 #include <casacore/ms/MSSel/MSSelectableTable.h>
148 const String& timeExpr=
"",
149 const String& antennaExpr=
"",
150 const String& fieldExpr=
"",
152 const String& uvDistExpr=
"",
153 const String& taqlExpr=
"",
154 const String& polnExpr=
"",
155 const String& scanExpr=
"",
156 const String& arrayExpr=
"",
157 const String& stateExpr=
"",
158 const String& observationExpr=
"",
159 const String& feedExpr=
"");
306 const Int defaultStep=1,
432 const Int defaultChanStep=1);
479 const String& outMSName=
"");
503 const String& timeExpr =
"",
504 const String& antennaExpr =
"",
505 const String& fieldExpr =
"",
506 const String& spwExpr =
"",
507 const String& uvDistExpr =
"",
508 const String& taqlExpr =
"",
509 const String& polnExpr =
"",
510 const String& scanExpr =
"",
511 const String& arrayExpr =
"",
512 const String& stateExpr =
"",
513 const String& observationExpr =
"");
518 const String& timeExpr =
"",
519 const String& antennaExpr =
"",
520 const String& fieldExpr =
"",
521 const String& spwExpr =
"",
522 const String& uvDistExpr =
"",
523 const String& taqlExpr =
"",
524 const String& polnExpr =
"",
525 const String& scanExpr =
"",
526 const String& arrayExpr =
"",
527 const String& stateExpr =
"",
528 const String& observationExpr =
"",
529 const String& feedExpr =
"");
537 const String& timeExpr =
"",
538 const String& antennaExpr =
"",
539 const String& fieldExpr =
"",
540 const String& spwExpr =
"",
541 const String& uvDistExpr =
"",
542 const String& taqlExpr =
"",
543 const String& polnExpr =
"",
544 const String& scanExpr =
"",
545 const String& arrayExpr =
"",
546 const String& stateExpr =
"",
547 const String& observationExpr =
"");
552 const String& timeExpr =
"",
553 const String& antennaExpr =
"",
554 const String& fieldExpr =
"",
555 const String& spwExpr =
"",
556 const String& uvDistExpr =
"",
557 const String& taqlExpr =
"",
558 const String& polnExpr =
"",
559 const String& scanExpr =
"",
560 const String& arrayExpr =
"",
561 const String& stateExpr =
"",
562 const String& observationExpr =
"",
563 const String& feedExpr =
"");
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
Matrix< Double > selectedUVRange_p
Vector< Int > getFeed2List(const MeasurementSet *ms=NULL)
Accessor for the list of the selected feed2 IDs.
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< Bool > getUVUnitsList(const MeasurementSet *ms=NULL)
Accessor for the list of user defined units for the uv-range(s).
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...
std::map< Int, Vector< Vector< Int > > > getCorrMap(const MeasurementSet *ms=NULL)
The key in the ordered map returned by getCorrMap() is the pol.
Bool setAntennaExpr(const String &antennaExpr)
Expression setters.
Bool setScanExpr(const String &scanExpr)
const MeasurementSet * getMS(MSSelectableTable *msLike)
Return the pointer to the MS used internally.
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.
Vector< Int > getDDIDList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Data Description IDs (DDID) from the polarization expression pa...
const String getExpr(const MSExprType type=NO_EXPR)
Accessor for the various selection expressions as strings.
Bool setStateExpr(const String &stateExpr)
Matrix< Int > getFeedPairList(const MeasurementSet *ms=NULL)
Similar to baselines for antennas.
Bool setTimeExpr(const String &timeExpr)
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.
Matrix< Double > getTimeList(const MeasurementSet *ms=NULL)
Accessor for the list of the specified time range(s) as the start and end MJD values.
Bool getSelectedMS(MeasurementSet &selectedMS, const String &outMSName="")
Return the selected MS.
void initErrorHandler(const MSExprType tye=NO_EXPR)
Initialize the error handler.
MSSelection & operator=(const MSSelection &other)
Assignment operator.
void clear(const MSExprType type=NO_EXPR)
Clear sub-expression and reset priority.
Vector< Int > getSPWDDIDList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Data Description IDs from the SPW expression parsing.
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...
Vector< Int > getStateObsModeList(const MeasurementSet *ms=NULL)
Accessor for the list of selected state Obs_Modes.
Bool setPolnExpr(const String &polnExpr)
Vector< Int > getFieldList(const MeasurementSet *ms=NULL)
Accessor for the list of selected field IDs.
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)
Vector< Int > getFeed1List(const MeasurementSet *ms=NULL)
Accessor for the list of the selected feed1 IDs.
Bool exprIsNull(const MSExprType type=NO_EXPR)
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< Vector< Int > > > selectedSetupMap_p
Bool setOrder(MSSelection::MSExprType type)
Set into the order of the selection expression.
Vector< Int > getAntenna2List(const MeasurementSet *ms=NULL)
Accessor for the list of antenna-2 of the selected baselines.
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.
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 > getSpwList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected Spectral Window IDs.
void clearErrorHandlers()
Set all error handlers to a known state (NULL).
Vector< Int > getScanList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected scan IDs.
Matrix< Double > selectedTimesList_p
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).
void setMaxArray(const Int &n=1000)
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.
Matrix< Int > getBaselineList(const MeasurementSet *ms=NULL)
Accessor for the list of selected baselines.
Vector< Int > antenna1IDs_p
Vector< Int > getSubArrayList(const MeasurementSet *ms=NULL)
Accessor for the list of selected sub-array IDs.
Matrix< Int > feedPairIDs_p
void runErrorHandler()
Execute the handleError() method of the error-handlers.
Vector< Int > getAntenna1List(const MeasurementSet *ms=NULL)
Accessor for the list of antenna-1 of the selected baselines.
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.
Vector< Int > getObservationList(const MeasurementSet *ms=NULL)
Accessor for the list of the selected observation IDs.
Matrix< Double > getChanFreqList(const MeasurementSet *ms=NULL, const Bool sorted=False)
Same as getChanList, except that the channels and steps are in Hz.
TableExprNode toTableExprNode(MSSelectableTable *msLike)
Convert to TableExprNode format (C++ interface to TaQL).
static String indexExprStr(Vector< Int > index)
Helper method for converting index vectors to expression strings.
Bool setUvDistExpr(const String &uvDistExpr)
Vector< Int > exprOrder_p
Priority.
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.