casacore
Loading...
Searching...
No Matches
MSSelection.h
Go to the documentation of this file.
1//# MSSelection.h: Class to represent a selection on an MS
2//# Copyright (C) 1996,1997,1998,1999,2001
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef MS_MSSELECTION_H
27#define MS_MSSELECTION_H
28
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>
41#include <map>
42
43namespace casacore { //# NAMESPACE CASACORE - BEGIN
44
45// <summary>
46// MSSelection: Class to represent a selection on an MS
47// </summary>
48
49// <use visibility=export>
50
51// <reviewed reviewer="" date="" tests="" demos="">
52
53// <prerequisite>
54// <li> <linkto class="MeasurementSet">MeasurementSet</linkto> module
55// </prerequisite>
56//
57// <etymology>
58// From "MeasurementSet" and "selection".
59// </etymology>
60//
61// <synopsis>
62// The MSSelection class represents a selection on a MeasurementSet (MS).
63// This class is used in translating MS selections represented as
64// selection items in the user interface, and for converting between
65// MS selection and pure TaQL selection.
66//
67// The purpose of this class is to provides a simple expression based
68// selection mechanism to both the end-user and developer wishing to
69// perform query operations over a measurement set. This is
70// accomplished by abstracting the TaQL interface through an
71// adapter/translation interface which converts STaQL (Simple Table
72// Query Language) expressions into the equivalent table expression
73// form, reducing the knowledge necessary to perform powerful query
74// operations directly in TaQL. It is also possible to supply pure
75// TaQL expression(s) as sub-expressions if required. For a complete
76// list of the STaQL interface refer to the MeasurementSet Selection Syntax document at: <a
77// href="http://casa.nrao.edu/other_doc.shtml">Data
78// Selection</a>
79//
80// The sub-expressions are interpreted in the order which they were
81// set. The order however in not important - any dependency on the
82// order in which the expressions are evaluated is handled internally.
83// The result of parsing the expressions is TableExprNode (TEN). All
84// TENs from sub-expressions are finally ANDed and the resultant TEN
85// is used to select the rows of the MS table.
86//
87// </synopsis>
88//
89// <example>
90// <srcblock>
91// // Create a MS and a MS selection
92// MeasurementSet ms(msName);
93// MSSelection select;
94// // Setup any sub-expressions of interest directly
95// // (or optionally send this information through a Record)
96// select.setFieldExpr("0,1");
97// select.setSpwExpr(">0");
98// // Create a table expression over a MS representing the selection
99// TableExprNode node = select.toTableExprNode(&ms);
100// // Optionally create a table and new MS based on this node
101// Table tablesel(ms.tableName(), Table::Update);
102// MeasurementSet mssel(tablesel(node, node.nrow()));
103// </srcblock>
104// </example>
105//
106// <motivation>
107// This class is used by the MS access classes.
108// </motivation>
109//
110// <todo asof="Aug/14/2009">
111// Generalize SpwExpressions and PolnExpressions to optionally include
112// DataDescription ID specifications.
113// </todo>
114
116 {
117 public:
134
135 // Default null constructor, and destructor
137 virtual ~MSSelection();
138
139 // Construct using an MS and the various selection expressions to
140 // be applied to the given MS. By default, the expressions will
141 // be parsed immediately. With mode=PARSE_LATE, the parsing will
142 // be done with a call to toTableExprNode().
144 const MSSMode& mode=PARSE_NOW,
145 const String& timeExpr="",
146 const String& antennaExpr="",
147 const String& fieldExpr="",
148 const String& spwExpr="",
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="");
157
158 // Construct from a record representing a selection item at the
159 // CLI or user interface level. This is functionally same as the
160 // constructor above with mode=PARSE_LATE.
161 MSSelection(const Record& selectionItem);
162
163 // Copy constructor
165
166 // Assignment operator
168
169 // Helper method for converting index vectors to expression strings
171
172 // Helper method for converting name vectors to expression strings
174
175 // Expression setters. The following set*Expr() methods only set
176 // the expressions. Parsing is done with a call to
177 // toTableExprNode().
178 Bool setAntennaExpr(const String& antennaExpr);
179 Bool setFieldExpr(const String& fieldExpr);
180 Bool setSpwExpr(const String& spwExpr);
181 Bool setScanExpr(const String& scanExpr);
182 Bool setArrayExpr(const String& ArrayExpr);
183 Bool setTimeExpr(const String& timeExpr);
184 Bool setUvDistExpr(const String& uvDistExpr);
185 Bool setTaQLExpr(const String& taqlExpr);
186 Bool setPolnExpr(const String& polnExpr);
187 Bool setStateExpr(const String& stateExpr);
188 Bool setObservationExpr(const String& observationExpr);
189 Bool setFeedExpr(const String& feedExpr);
190
191 // Accessor for the various selection expressions as strings.
192 const String getExpr(const MSExprType type=NO_EXPR);
193
194 // Accessor for result of parsing all of the selection
195 // expressions. The final TableExprNode (TEN) is the result of
196 // ANDing the TENs for the individual expressions.
198
199 // Accessor for the list of the selected scan IDs.
200 inline Vector<Int> getScanList(const MeasurementSet* ms=NULL)
201 {getTEN(ms); return scanIDs_p;}
202
203 // Accessor for the list of the selected observation IDs.
205 {getTEN(ms); return observationIDs_p;}
206
207 // Accessor for the list of the selected feed1 IDs.
209 {getTEN(ms); return feed1IDs_p;}
210
211 // Accessor for the list of the selected feed2 IDs.
213 {getTEN(ms); return feed2IDs_p;}
214
215 // Similar to baselines for antennas
217 {getTEN(ms); return feedPairIDs_p;}
218
219 // Accessor for the list of selected sub-array IDs.
221 {getTEN(ms); return arrayIDs_p;}
222
223 // Accessor for the list of antenna-1 of the selected baselines.
224 // Antennas affected by the baseline negation operator have the
225 // antenna IDs multiplied by -1.
227 {// if (antenna1IDs_p.nelements() <= 0)
228 getTEN(ms); return antenna1IDs_p;}
229
230 // Accessor for the list of antenna-2 of the selected baselines.
231 // Antennas affected by the baseline negation operator have the
232 // antenna IDs multiplied by -1.
234 {// if (antenna2IDs_p.nelements() <= 0)
235 getTEN(ms); return antenna2IDs_p;}
236
237 // Accessor for the list of selected baselines. The list is a Nx2
238 // Matrix with one row per baseline containing the antenna IDs of
239 // the two antenna associated with the baseline.
240 //
241 // Baselines affected by the negation operator in the baseline
242 // selection expression are reported with one or both the antenna
243 // IDs multiplied by -1. E.g. a baseline selection expression
244 // "!1" will result in a baseline list
245 //
246 // [-1, 2],
247 // [-1, 3],
248 // [-1, 4],
249 // ....
250 //
251 // The expression "!1&10" will result in a baseline list [-1,
252 // -10]. Etc...
253 //
255 {getTEN(ms); return baselineIDs_p;}
256
257 // Accessor for the list of selected field IDs.
259 {// if (fieldIDs_p.nelements() <= 0)
260 getTEN(ms); return fieldIDs_p;}
261
262 // Accessor for the list of selected state Obs_Modes.
265
266 // Accessor for the list of the specified time range(s) as the
267 // start and end MJD values. The time ranges are stored as columns,
268 // i.e. the output Matrix is 2 x n_ranges.
270 {getTEN(ms); return selectedTimesList_p;}
271
272 // Accessor for the list of the specified uv-range(s) as the start
273 // and end values in units used in the MS.
275 {getTEN(ms); return selectedUVRange_p;}
276
277 // Accessor for the list of user defined units for the
278 // uv-range(s). The uv-range(s) return by getUVList is always in
279 // the units used in the MS.
281 {getTEN(ms); return selectedUVUnits_p;}
282
283 // Accessor for the list of the selected Spectral Window IDs.
284 inline Vector<Int> getSpwList(const MeasurementSet* ms=NULL)
285 {// if (spwIDs_p.nelements() <= 0)
286 getTEN(ms); return spwIDs_p;}
287
288 // Accessor for the table (as a nx4 Matrix) of the selected
289 // Spectral Windows and associated ranges of selected channels.
290 // Each row of the Matrix has the following elements:
291 //
292 // SpwID StartCh StopCh Step
293 //
294 // where StartCh, StopCh and Step are the first and the last
295 // selected channels and step is the step size. If no step size
296 // was supplied as part of the expression, the value of Step is
297 // replaced with the value of the defaultStep parameter. Multiple
298 // channel specifications for the same Spectral Window selection,
299 // results in multiple rows in the Matrix. If sorted is True, the
300 // rows of the output Matrix will be sorted by the SPW IDs (the
301 // entries in the first column).
303 const Int defaultStep=1,
304 const Bool sorted=False);
305
306 //
307 // Same as getChanList, except that the channels and steps are in Hz.
308 //
310 const Bool sorted=False);
311
312 // Accessor for the list of the selected Data Description IDs
313 // (DDID) from the polarization expression parsing. The actual
314 // selected DDIDs would be an intersection of the DDIDs selected
315 // from polarization and SPW expressions parsing (see
316 // getSPWDDIDList() below).
317 // Note that there is no guarantee that returned vector
318 // is inmight not be in sorted order.
319 inline Vector<Int> getDDIDList(const MeasurementSet* ms=NULL)
320 {if (ddIDs_p.nelements() <= 0) getTEN(ms); return ddIDs_p;}
321
322 // Accessor for the list of the selected Data Description IDs from
323 // the SPW expression parsing. The actual
324 // selected DDIDs would be an intersection of the DDIDs selected
325 // from polarization and SPW expressions parsing (see
326 // getDDIDList() above).
327 //
328 // The actual DDIDs selected will be an intersection of the lists
329 // from getDDIDList() and getSPWDDIDList() (which can be generated
330 // using the set_intersection(Vector<Int>&, Vector<Int>&) global
331 // method in MSSelectionTool.{cc,h}).
333 {if (spwDDIDs_p.nelements() <= 0) getTEN(ms); return spwDDIDs_p;}
334
335 //
336 // The key in the ordered map returned by getPolMap() is the Data
337 // Description ID (DDID). The value is a vector containing the
338 // list of in-row indices to pick out the selected polarizations
339 // (or equivalently, the list of indices for the vector in the
340 // corrType column of the POLARIZATION sub-table). These are also
341 // what the user intended (i.e., e.g. not all DD IDs due to user
342 // POL expression might be selected due to SPW expressions).
343 //
344 inline std::map<Int, Vector<Int> > getPolMap(const MeasurementSet* ms=NULL)
345 {getTEN(ms); return selectedPolMap_p;};
346
347 //
348 // The key in the ordered map returned by getCorrMap() is the
349 // pol. in the Data Description ID (DDID) sub-table. The value is
350 // a Vector of two Vectors.
351 //
352 // The returned Map<T> has a key that maps to two vectors:
353 // Key ----> Vector1 Vector2
354 //
355 // Key : Row index in the POLARIZATION sub-table
356 //
357 // Vector1 : List of poln. indices selected from the row pointed
358 // by Key. These are the in-row indices to pick-out the
359 // desired (selected) polarization products from the
360 // selected rows of the MS (or equivalently, the list of
361 // indices for the vector in the corrType column of the
362 // POLARIZATION sub-table).
363 //
364 // Vector2 : List of selected rows from the DATA_DESCRIPTION sub-table
365 //
366 // An example: following are the sub-tables used for the example
367 // explaination below:
368 //
369 // POLARIZATION Sub-table
370 // ======================
371 // Row Poln
372 // ------------
373 // 0 RR, LL
374 // 1 RR, LR, RL, LL
375 //
376 // DATA_DESCRIPTION Sub-table
377 // ==========================
378 // Row PolnID SpwID
379 // ------------------------------
380 // 0 0 0
381 // 1 1 1
382 // 2 1 2
383 // 3 1 3
384 // 4 1 4
385 // 5 1 5
386 // 6 1 6
387 // 7 1 7
388 // 8 1 8
389 //
390 //
391 // E.g., the expression poln='LL'
392 //
393 // returns the Map:
394 //
395 // corrmap = (0, [[1], [0]]) (1, [[3], [0,1,2,3,4,5,6,7,8]] )
396 //
397 // The rows from the POLARIZATION table selected are 0 and 1, These are
398 // two keys for the two entries in the map.
399 //
400 // 1. The two vectors in map 1 are: [1] and [0]. The this reads as:
401 // From the 0th. row of the POLARIZATION table, use the indices [1]. The
402 // relevant list of associated DD rows are [0]
403 //
404 // 2. The two vectors in map 2 are: [3] and [0,1,2,3,4,5,6,7,8]. This reads as:
405 // From the 1st. row of the POLARIZATION table, use the indices [3]. The
406 // relevant list of associated DD rows are [0,1,2,3,4,5,6,7,8].
407 //
408 // For a client code:
409 //
410 // o To get a list of the DDIDs selected, iterate over all entries of the
411 // map and collate the second vector from each entry.
412 //
413 // Or, use getDDIDList().
414 //
415 // o To get the list of the selected poln. *in-row indices*, collate the
416 // first vector from each entry.
417 //
418 // o To get a list of POLARIZATION IDs selected (rows of the POLARIZATION
419 // table), make a list of all the keys of this map.
420 inline std::map<Int, Vector<Vector<Int> > > getCorrMap(const MeasurementSet* ms=NULL)
421 {getTEN(ms); return selectedSetupMap_p;};
422
423 // Methods to convert the maps return by getChanList and
424 // getCorrMap to a list of Slice which can be directly used by
425 // Table system for in-row selection of frequency channels and
426 // polarizations.
427 void getChanSlices(Vector<Vector<Slice> >& chanslices,
428 const MeasurementSet* ms=NULL,
429 const Int defaultChanStep=1);
430
432 const MeasurementSet* ms=NULL);
433
434
435 // Clear sub-expression and reset priority. Default behavior is to
436 // reset all sub-expressions.
437 void clear(const MSExprType type=NO_EXPR);
438
439 // Set all error handlers to a known state (NULL).
441
443
444 // Convey to the various parsers to delete the TENs they hold
446
447 // Delete error handlers (mostly the internally allocated ones).
449
450 // Convert to TableExprNode format (C++ interface to TaQL). This
451 // is now for purely backwards compatibility and ease of use. It
452 // internally constructs the MSSelectableTable from the supplied
453 // MS and calls the generic version of toTableExprNode below
454 // (which works with MSSelectableTable object).
456
457 // Convert to TableExprNode format (C++ interface to TaQL). The
458 // MSSelectableTable is a pure-virtual base class which provides a
459 // generic interface both to MeasurementSet and CalTable (in the
460 // synthesis module) services used in MSSelection. The actual
461 // objects used for supplying MeasurementSet or CalTable to
462 // MSSelection are MSInterface and CTInterface classes
463 // respectively. With this, MSSelection module can be used for
464 // selection on MeasurementSet or CalTable.
466
467 // Return the selected MS. The selected MS reflects only row
468 // selections (as against in-row selections). If outMSName != "",
469 // the selected MS is also written to the disk (a shallow copy).
470 //
471 // For in-row selection, use the appropriate global function
472 // mssSetData() MSSelectionTools.h which also returns the in-row
473 // (corr/chan) slices that can be supplied to the VisIter object
474 // for on-the-fly in-row selection.
476 const String& outMSName="");
477
478 void resetMS(const MeasurementSet& ms) {resetTEN(); ms_p=&ms;};
480
481
482 // The MSSelection object is designed to be re-usable object. The
483 // following reset() methods set the internal state of the object
484 // to same state as with the equivalent constructor.
485 //
486 // mode can be one of the MSSModes. MSSMode::PARSE_NOW will parse
487 // the given expressions and internally hold the final TEN
488 // (i.e. will also internally call toTableExprNode()). The
489 // internal TEN can be accessed via the getTEN() method.
490 // MSSMode::PARSE_LATER will only set the expression strings.
491 // Parsing will be done later with a call to toTableExprNode().
492 //
493 // This version, here for backward compatibility reasons,
494 // internally constructs a
495 // <linkto class="MSSelectableTable">MSSelectableTable</linkto>
496 // object and calls the reset() method below that works with
497 // MSSelectableTable.
498 void reset(const MeasurementSet& ms,
499 const MSSMode& mode = PARSE_NOW,
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 = "");
511
512 // Add feedExpr; keep old signature for backwards compatibility
513 void reset2(const MeasurementSet& ms,
514 const MSSMode& mode = PARSE_NOW,
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 = "");
527
528 // This version of reset() works with generic MSSelectableTable
529 // object. Accessing the services of the MSSelection module via
530 // this interface is recommended over the version of reset() that
531 // uses MeasurementSet.
533 const MSSMode& mode = PARSE_NOW,
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 = "");
545
546 // Add feedExpr; keep old signature for backwards compatibility
548 const MSSMode& mode = PARSE_NOW,
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 = "");
561
562 // Set the maximum value acceptable for SCAN, OBSERVATION or
563 // SUB-ARRAY IDs. The main-table columns for these do not refere
564 // to rows of sub-tables and therefore there is no cheap way to
565 // find a valid range for these which can be used in the parsers
566 // to generate error or warning messages if a value outside the
567 // range is used in the expressions. The default maximum value
568 // for scan, observation and sub-array IDs is 1000.
569 inline void setMaxScans(const Int& n=1000) {maxScans_p=n;};
570 inline void setMaxObs(const Int& n=1000) {maxObs_p=n;};
571 inline void setMaxArray(const Int& n=1000) {maxArray_p=n;};
572
573 // Set the error handler to be used for reporting errors while
574 // parsing the type of expression give by the first argument.
576 const Bool overRide=True);
577
578 // Initialize the error handler. This is set the error-handler to
579 // the user supplied error handler via setErrorHandler() or to the
580 // default built-in error handler.
582
583 // Execute the handleError() method of the error-handlers. This
584 // is called in the catch code for any exceptions emitted from any
585 // of the parsers. It is also called at the end of the
586 // parsing cycle.
588
589 // Return the pointer to the MS used internally.
591
592 private:
593 // Set into the order of the selection expression
595
596 // Initialize from a Record representing a selection
597 // item from the user interface or CLI
598 void fromSelectionItem(const Record& selectionItem);
599
600 // Check if record field exists and is not unset
601 Bool definedAndSet(const Record& inpRec, const String& fieldName);
602
603 // Convert an MS select string to TaQL
604 // const String msToTaQL(const String& msSelect) {};
605
608 // Selection expressions
621 // Priority
631 std::map<Int, Vector<Int> > selectedPolMap_p;
632 std::map<Int, Vector<Vector<Int> > > selectedSetupMap_p;
635 };
636
637} //# NAMESPACE CASACORE - END
638
639#endif
640
641
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
Definition ArrayBase.h:101
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.
Vector< Int > arrayIDs_p
Vector< Int > feed2IDs_p
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...
Vector< Int > fieldIDs_p
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.
Vector< Int > ddIDs_p
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.
Vector< Int > spwDDIDs_p
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.
Vector< Int > scanIDs_p
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.
Vector< Int > feed1IDs_p
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)
Matrix< Int > chanIDs_p
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.
Vector< Int > spwIDs_p
Matrix< Int > getFeedPairList(const MeasurementSet *ms=NULL)
Similar to baselines for antennas.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41