casacore
Loading...
Searching...
No Matches
MSAntennaParse.h
Go to the documentation of this file.
1//# MSAntennaParse.h: Classes to hold results from antenna grammar parser
2//# Copyright (C) 1994,1995,1997,1998,1999,2000,2001,2003
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_MSANTENNAPARSE_H
27#define MS_MSANTENNAPARSE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/ms/MSSel/MSSelectionErrorHandler.h>
33#include <casacore/casa/Arrays/Matrix.h>
34#include <bitset>
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37 //# Forward Declarations
38
39 // <summary>
40 // Class to hold values from antenna grammar parser
41 // </summary>
42
43 // <use visibility=local>
44
45 // <reviewed reviewer="" date="" tests="">
46 // </reviewed>
47
48 // <prerequisite>
49 //# Classes you should understand before using this one.
50 // </prerequisite>
51
52 // <etymology>
53 // MSAntennaParse is the class used to parse a antenna command.
54 // </etymology>
55
56 // <synopsis>
57 // MSAntennaParse is used by the parser of antenna sub-expression statements.
58 // The parser is written in Bison and Flex in files MSAntennaGram.y and .l.
59 // The statements in there use the routines in this file to act
60 // upon a reduced rule.
61 // Since multiple tables can be given (with a shorthand), the table
62 // names are stored in a list. The variable names can be qualified
63 // by the table name and will be looked up in the appropriate table.
64 //
65 // The class MSAntennaParse only contains information about a table
66 // used in the table command. Global variables (like a list and a vector)
67 // are used in MSAntennaParse.cc to hold further information.
68 //
69 // Global functions are used to operate on the information.
70 // The main function is the global function msAntennaCommand.
71 // It executes the given STaQL command and returns the resulting ms.
72 // This is, in fact, the only function to be used by a user.
73 // </synopsis>
74
75 // <motivation>
76 // It is necessary to be able to give a ms command in ASCII.
77 // This can be used in a CLI or in the table browser to get a subset
78 // of a table or to sort a table.
79 // </motivation>
80
81 //# <todo asof="$DATE:$">
82 //# A List of bugs, limitations, extensions or planned refinements.
83 //# </todo>
84
85
86 class MSAntennaParse : public MSParse
87 {
88
89 public:
90 // Define the operator types (&&&, &&, and &).
93
94 // Default constructor
96
97 // Associate the ms.
99
100 MSAntennaParse (const MSAntenna& antSubTable,
101 const TableExprNode& ant1AsTEN, const TableExprNode& ant2AsTEN);
102
104
105 // Add the given antennae selection.
106 const TableExprNode* selectAntennaIds(const Vector<Int>& antennaIds,
107 BaselineListType baselineType=CrossOnly,
108 Bool negate=False);
109
110 // Add the given baseline selection.
111 const TableExprNode* selectAntennaIds(const Vector<Int>& antennaIds1,
112 const Vector<Int>& antennaIds2,
113 BaselineListType baselineType=CrossOnly,
114 Bool negate=False);
115
116 // Select by name or station number.
118 BaselineListType baselineType=CrossOnly,
119 Bool negate=False);
121 const Vector<String>& antenna2,
122 BaselineListType baselineType=CrossOnly,
123 Bool negate=False);
124
126 const String& antenna2,
127 BaselineListType baselineType=CrossOnly,
128 Bool negate=False);
129
130 // Selection on baseline regex
131 const TableExprNode* selectBLRegex(const std::vector<String>& lengths,
132 Bool negate=False);
133
134 // Selection on baseline length
135 const TableExprNode* selectLength(const std::vector<double>& lengths,
136 Bool negate=False);
137
138 // Get a pointer to the table expression node object.
140 { return node_p; }
142 { return ant1List; }
144 { return ant2List; }
146 { return baselineList; }
147
148 // Get the factor to convert the given unit to m.
149 static double getUnitFactor (const char* unit);
150
152 {if (level==RESET) complexity.reset(); else complexity.set(level,True);}
153 std::bitset<HIGHESTLEVEL> getComplexity() {return complexity;}
155 private:
157 Bool negate);
159 BaselineListType baselineType=CrossOnly,
160 Bool negate=False);
163 BaselineListType baselineType=CrossOnly,
164 Bool negate=False);
165 void makeAntennaList(Vector<Int>& antList,const Vector<Int>& thisList,
166 Bool negate=False);
167 Bool addBaseline(const Matrix<Int>& baselist,
168 const Int ant1, const Int ant2,
169 BaselineListType baselineType=CrossOnly);
170
171 //# Data members.
172 public:
174 static std::shared_ptr<MSSelectionErrorHandler> thisMSAErrorHandler;
176 std::bitset<HIGHESTLEVEL> complexity;
177 private:
184 };
185
186} //# NAMESPACE CASACORE - END
187
188#endif
std::bitset< HIGHESTLEVEL > complexity
void makeAntennaList(Vector< Int > &antList, const Vector< Int > &thisList, Bool negate=False)
const Matrix< Int > & selectedBaselines() const
static void cleanupErrorHandler()
MSAntennaParse(const MeasurementSet *ms)
Associate the ms.
const TableExprNode * selectAntennaIds(const Vector< Int > &antennaIds, BaselineListType baselineType=CrossOnly, Bool negate=False)
Add the given antennae selection.
BaselineListType
Define the operator types (&&&, &&, and &).
const TableExprNode * selectNameOrStation(const Vector< String > &antenna1, const Vector< String > &antenna2, BaselineListType baselineType=CrossOnly, Bool negate=False)
static TableExprNode column2AsTEN_p
static MSAntennaParse * thisMSAParser
const TableExprNode * selectNameOrStation(const Vector< String > &antenna, BaselineListType baselineType=CrossOnly, Bool negate=False)
Select by name or station number.
const TableExprNode * selectAntennaIds(const Vector< Int > &antennaIds1, const Vector< Int > &antennaIds2, BaselineListType baselineType=CrossOnly, Bool negate=False)
Add the given baseline selection.
const TableExprNode * setTEN(TableExprNode &condition, BaselineListType baselineType=CrossOnly, Bool negate=False)
static std::shared_ptr< MSSelectionErrorHandler > thisMSAErrorHandler
const Vector< Int > & selectedAnt1() const
void setComplexity(const ComplexityLevels &level=RESET)
const Vector< Int > & selectedAnt2() const
MSAntennaParse()
Default constructor.
Bool addBaseline(const Matrix< Int > &baselist, const Int ant1, const Int ant2, BaselineListType baselineType=CrossOnly)
static TableExprNode column1AsTEN_p
const TableExprNode * selectBLRegex(const std::vector< String > &lengths, Bool negate=False)
Selection on baseline regex.
void makeBaselineList(const Vector< Int > &a1, const Vector< Int > &a2, Matrix< Int > &b, BaselineListType baselineType=CrossOnly, Bool negate=False)
MSAntennaParse(const MSAntenna &antSubTable, const TableExprNode &ant1AsTEN, const TableExprNode &ant2AsTEN)
std::bitset< HIGHESTLEVEL > getComplexity()
static double getUnitFactor(const char *unit)
Get the factor to convert the given unit to m.
Matrix< double > getBaselineLengths()
TableExprNode node() const
Get a pointer to the table expression node object.
const TableExprNode * selectLength(const std::vector< double > &lengths, Bool negate=False)
Selection on baseline length.
const TableExprNode * selectNameOrStation(const String &antenna1, const String &antenna2, BaselineListType baselineType=CrossOnly, Bool negate=False)
const TableExprNode * makeBLNode(const Matrix< Bool > &match, Bool negate)
MeasurementSet * ms()
Get ms object.
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