casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSSelection.h
Go to the documentation of this file.
1 //# PlotMSSelection.h: casacore::MS Selection parameters.
2 //# Copyright (C) 2009
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: aips2-request@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 //# $Id: $
27 #ifndef PLOTMSSELECTION_H_
28 #define PLOTMSSELECTION_H_
29 
30 #include <casa/Containers/Record.h>
31 #include <ms/MSSel/MSSelection.h>
35 
36 #include <map>
37 
38 namespace casacore{
39 
40 class MeasurementSet;
41 }
42 
43 namespace casa {
44 
45 //# Forward declarations
46 class NewCalTable;
47 
48 // Specifies an casacore::MS selection. See the mssSetData method in
49 // ms/MSSel/MSSelectionTools.h for details.
51 public:
52  // Static //
53 
54  // Enum and methods to define the different fields for an casacore::MS selection.
55  // **If these are changed, also update: convenience methods below,
56  // xmlcasa/implement/plotms/plotms*, xmlcasa/tasks/plotms.xml,
57  // xmlcasa/scripts/task_plotms.py.**
58  // <group>
60  FIELD, SPW, TIMERANGE, UVRANGE, ANTENNA, SCAN,
61  CORR, ARRAY, OBSERVATION, INTENT, FEED, MSSELECT)
63  "field", "spw", "timerange", "uvrange", "antenna", "scan",
64  "corr", "array", "observation", "intent", "feed", "msselect")
65  // </group>
66 
67  // Returns the default value for the given selection field. Returns an
68  // empty casacore::String except for FIELD which returns "2".
69  static casacore::String defaultValue(Field f);
70 
71 
72  // Non-Static //
73 
74  // Default constructor.
76 
77  // Copy constructor. See operator=().
79 
80  // Destructor.
81  ~PlotMSSelection();
82 
83 
84  // Converts this object to/from a record. The record keys are the values
85  // of the Field enum in casacore::String form, and the values are the
86  // casacore::String values.
87  // <group>
88  void fromRecord(const casacore::RecordInterface& record);
89  casacore::Record toRecord() const;
90  // </group>
91 
92  //Print out an abbreviated summary of the selection.
93  casacore::String toStringShort() const;
94 
95  // Applies this selection using the first casacore::MS into the second MS.
96  // (See the mssSetData method in ms/MSSel/MSSelectionTools.h for details.)
97  void apply(casacore::MeasurementSet& ms, casacore::MeasurementSet& selectedMS,
99  casacore::Vector<casacore::Vector<casacore::Slice> >& corrsel);
100 
101  // Applies this selection to a NewCalTable
102  void apply(NewCalTable& ct, NewCalTable& selectedCT,
103  casacore::Vector<casacore::Vector<casacore::Slice> >& chansel,
104  casacore::Vector<casacore::Vector<casacore::Slice> >& corrsel);
105 
106  // Applies this selection to a Table
107  void apply(CalTable& ct, CalTable& selectedCT,
108  casacore::Vector<casacore::Vector<casacore::Slice> >& chansel,
109  casacore::Vector<casacore::Vector<casacore::Slice> >& corrsel);
110 
111  // Gets/Sets the value for the given selection field.
112  // <group>
113  const casacore::String& getValue(Field f) const;
114  void getValue(Field f, casacore::String& value) const { value = getValue(f); }
115  void setValue(Field f, const casacore::String& value);
116  // </group>
117 
118  // Convenience methods for returning the standard selection fields.
119  // <group>
120  const casacore::String& field() const { return getValue(FIELD); }
121  const casacore::String& spw() const { return getValue(SPW); }
122  const casacore::String& timerange() const { return getValue(TIMERANGE); }
123  const casacore::String& uvrange() const { return getValue(UVRANGE); }
124  const casacore::String& antenna() const { return getValue(ANTENNA); }
125  const casacore::String& scan() const { return getValue(SCAN); }
126  const casacore::String& corr() const { return getValue(CORR); }
127  const casacore::String& array() const { return getValue(ARRAY); }
128  const casacore::String& observation() const {return getValue(OBSERVATION);}
129  const casacore::String& intent() const { return getValue(INTENT);}
130  const casacore::String& feed() const { return getValue(FEED);}
131  const casacore::String& msselect() const { return getValue(MSSELECT); }
132  const casacore::Int& forceNew() const { return forceNew_; }
133  // </group>
134 
135  // Convenience methods for setting the standard selection fields.
136  // <group>
137  void setField(const casacore::String& v) { setValue(FIELD, v); }
138  void setSpw(const casacore::String& v) { setValue(SPW, v); }
139  void setTimerange(const casacore::String& v) { setValue(TIMERANGE, v); }
140  void setUvrange(const casacore::String& v) { setValue(UVRANGE, v); }
141  void setAntenna(const casacore::String& v) { setValue(ANTENNA, v); }
142  void setScan(const casacore::String& v) { setValue(SCAN, v); }
143  void setCorr(const casacore::String& v) { setValue(CORR, v); }
144  void setArray(const casacore::String& v) { setValue(ARRAY, v); }
145  void setObservation(const casacore::String& v) {setValue(OBSERVATION, v); }
146  void setIntent(const casacore::String& v) { setValue(INTENT, v); }
147  void setFeed(const casacore::String& v) { setValue(FEED, v); }
148  void setMsselect(const casacore::String& v) { setValue(MSSELECT, v); }
149  void setForceNew(const casacore::Int& forcenew) { forceNew_ = forcenew; }
150  // </group>
151 
152  // Equality operators.
153  // <group>
154  bool operator==(const PlotMSSelection& other) const;
155  bool operator!=(const PlotMSSelection& other) const {
156  return !(operator==(other)); }
157 
158  bool fieldsEqual(const PlotMSSelection& other) const;
159  bool fieldsNotEqual(const PlotMSSelection& other) const {
160  return !fieldsEqual(other); }
161 
162  // </group>
163 
164  // Copy operator.
166 
167  //Return lists of antennas that have been selected.
170 
171  //Returns whether or not any selections have been made.
172  bool isEmpty() const;
173 
174 private:
175  // Selection field values.
176  std::map<Field, casacore::String> itsValues_;
177 
178  // Force appearance of new selection (even when not new)
182 
183  // Initializes the values to their defaults.
184  void initDefaults();
185 
186  // CalTable::select uses taql string for selection
188  // handle negation
191  // For MS + MSSelection
193 };
194 
195 }
196 
197 #endif /* PLOTMSSELECTION_H_ */
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
casacore::Int forceNew_
Force appearance of new selection (even when not new)
static msselect casacore::String defaultValue(Field f)
Returns the default value for the given selection field.
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
#define PMS_ENUM2(NAME, ALLMETHOD, ALLSTRMETHOD, CONVMETHOD,...)
void fromRecord(const casacore::RecordInterface &record)
Converts this object to/from a record.
const casacore::String & observation() const
void setUvrange(const casacore::String &v)
PlotMSSelection & operator=(const PlotMSSelection &copy)
Copy operator.
const casacore::String & intent() const
bool fieldsNotEqual(const PlotMSSelection &other) const
casacore::String getMSName(CalTable &ct)
For MS + MSSelection.
Specifies an casacore::MS selection.
void setMsselect(const casacore::String &v)
void setFeed(const casacore::String &v)
const casacore::String & getValue(Field f) const
Gets/Sets the value for the given selection field.
bool isEmpty() const
Returns whether or not any selections have been made.
const casacore::String & field() const
Convenience methods for returning the standard selection fields.
casacore::String getAntTaql(casacore::MSSelection &mss, casacore::MeasurementSet &ms, casacore::String antExpr)
handle negation
casacore::Vector< int > selAnts1
const casacore::String & timerange() const
CalTable: Calibration table access and creation.
Definition: CalTable.h:82
const casacore::String & spw() const
casacore::Vector< int > getSelectedAntennas2()
void setObservation(const casacore::String &v)
casacore::String getTaql(CalTable &ct)
CalTable::select uses taql string for selection.
define a (start,length,increment) along an axis
Definition: Slice.h:93
const casacore::String & antenna() const
void setField(const casacore::String &v)
Convenience methods for setting the standard selection fields.
const casacore::String & array() const
casacore::String toStringShort() const
Print out an abbreviated summary of the selection.
MSSelection: Class to represent a selection on an MS.
Definition: MSSelection.h:118
casacore::Record toRecord() const
A hierarchical collection of named fields of various types.
Definition: Record.h:180
void setAntenna(const casacore::String &v)
PMS_ENUM1(Field, fields, fieldStrings, field, FIELD, SPW, TIMERANGE, UVRANGE, ANTENNA, SCAN, CORR, ARRAY, OBSERVATION, INTENT, FEED, MSSELECT) PMS_ENUM2(Field
Static //.
bool operator!=(const PlotMSSelection &other) const
const casacore::String & msselect() const
casacore::Vector< int > selAnts2
void setArray(const casacore::String &v)
casacore::Vector< int > getSelectedAntennas1()
Return lists of antennas that have been selected.
A Table intended to hold astronomical data (a set of Measurements).
void setCorr(const casacore::String &v)
void apply(casacore::MeasurementSet &ms, casacore::MeasurementSet &selectedMS, casacore::Vector< casacore::Vector< casacore::Slice > > &chansel, casacore::Vector< casacore::Vector< casacore::Slice > > &corrsel)
Applies this selection using the first casacore::MS into the second MS.
const casacore::String & scan() const
void setScan(const casacore::String &v)
void setTimerange(const casacore::String &v)
const casacore::String & uvrange() const
void initDefaults()
Initializes the values to their defaults.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const casacore::String & corr() const
std::map< Field, casacore::String > itsValues_
Selection field values.
void setForceNew(const casacore::Int &forcenew)
bool fieldsEqual(const PlotMSSelection &other) const
Abstract base class for Record classes.
void setSpw(const casacore::String &v)
const casacore::Int & forceNew() const
const casacore::String & feed() const
void setValue(Field f, const casacore::String &value)
bool operator==(const PlotMSSelection &other) const
Equality operators.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void getValue(Field f, casacore::String &value) const
void setIntent(const casacore::String &v)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42