casacore
Loading...
Searching...
No Matches
MSPolnParse.h
Go to the documentation of this file.
1//# MSPolnParse.h: Classes to hold results from poln grammar parseing
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_MSPOLNPARSE_H
27#define MS_MSPOLNPARSE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/ms/MeasurementSets/MSPolarization.h>
33#include <casacore/ms/MeasurementSets/MSPolColumns.h>
34#include <casacore/ms/MSSel/MSPolIndex.h>
35#include <casacore/ms/MSSel/MSDataDescIndex.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39//# Forward Declarations
40
41
42// <summary>
43// Class to hold values from field grammar parser
44// </summary>
45
46// <use visibility=local>
47
48// <reviewed reviewer="" date="" tests="">
49// </reviewed>
50
51// <prerequisite>
52//# Classes you should understand before using this one.
53// </prerequisite>
54
55// <etymology>
56// MSPolnParse is the class used to parse a polarization selection command.
57// </etymology>
58
59// <synopsis>
60//
61// MSPolnParse is used by the parser of polarization sub-expression
62// statements of the type [SPW:]POLN. Since this is a relatively
63// simple expression to tokenize and parse, this parser is written
64// without Bison or Flex. The methods of this class take an
65// expression, and internally generate a list of the Data Description
66// IDs that should be used to select the rows in the MS main table.
67// The map of Polarization IDs (row numbers in the POLARIZATION
68// sub-table) and the list of indices to be used to pick the user
69// selected polarzation data (in the DATA columns of the MS main
70// table) is also generated. This map is intended to be used along
71// with the map of SPW and selected channels to apply the in-row
72// selection (Slice on the data columns).
73//
74// </synopsis>
75
76// <motivation>
77// It is necessary to be able to give a data selection
78// command in ASCII. This can be used in a CLI or in the table
79// browser to get a subset of a table or to sort a table.
80// </motivation>
81
82//# <todo asof="$DATE:$">
83//# A List of bugs, limitations, extensions or planned refinements.
84//# </todo>
85
86
87class MSPolnParse : public MSParse
88{
89public:
90 // Default constructor
92 // ~MSPolnParse() {cleanup();}
93
94 // Associate the ms and the shorthand.
96
98
99 // Get table expression node object.
101 // static MSPolnParse* thisMSSParser;
102 void reset() {polMap_p.clear(); ddIDList_p.resize(0);}
103 void cleanup() {/*if (node_p) delete node_p;node_p=0x0;*/}
104 Int theParser(const String& command);
105 // Vector<Int>& selectedDDIDs,
106 // Matrix<Int>& selectedSpwPolnMap);
107 std::map<Int, Vector<Int> > selectedPolnMap() {return polMap_p;}
108 std::map<Int, Vector<Vector<Int> > > selectedSetupMap() {return setupMap_p;}
110private:
112 const Vector<Int>& spwIDs, Vector<Int>& polnIDs,
113 Vector<Int>& polIndices);
115 std::map<Int, Vector<Int> >& polIndexMap,
116 Vector<Int>& polIndices,
117 Bool addToMap=False);
118 Vector<Int> getPolnIDs(const String& polSpec, Vector<Int>& polIndices);
119 Vector<Int> getPolnIndices(const Int& polnID, const Vector<Int>& polnIDList);
120 //
121 // These are the versions used in the code.
122 Vector<Int> getPolnIDsV2(const String& polSpec, Vector<Int>& polTypes);
124 const Vector<Int>& spwIDs,
125 Vector<Int>& polnIDs,
126 Vector<Int>& polnIndices);
129 std::map<Int, Vector<Int> > polMap_p;
130 std::map<Int, Vector<Vector<Int> > > setupMap_p;
131
132 void setIDLists(const Int key, const Int ndx, Vector<Int>& val);
133};
134
135} //# NAMESPACE CASACORE - END
136
137#endif
MeasurementSet * ms()
Get ms object.
std::map< Int, Vector< Int > > selectedPolnMap()
Vector<Int>& selectedDDIDs, Matrix<Int>& selectedSpwPolnMap);.
Vector< Int > getMapToDDIDsV2(const String &polExpr, const Vector< Int > &spwIDs, Vector< Int > &polnIDs, Vector< Int > &polnIndices)
Vector< Int > ddIDList_p
const TableExprNode selectFromIDList(const Vector< Int > &ddIDs)
std::map< Int, Vector< Int > > polMap_p
TableExprNode node_p
Vector< Int > getPolnIndices(const Int &polnID, const Vector< Int > &polnIDList)
Vector< Int > getMapToDDIDs(MSDataDescIndex &msDDNdx, MSPolarizationIndex &msPolNdx, const Vector< Int > &spwIDs, Vector< Int > &polnIDs, Vector< Int > &polIndices)
Int theParser(const String &command)
Vector< Int > selectedDDIDs()
std::map< Int, Vector< Vector< Int > > > selectedSetupMap()
Vector< Int > matchPolIDsToPolTableRow(const Vector< Int > &polIds, std::map< Int, Vector< Int > > &polIndexMap, Vector< Int > &polIndices, Bool addToMap=False)
const TableExprNode node()
Get table expression node object.
void reset()
static MSPolnParse* thisMSSParser;
MSPolnParse(const MeasurementSet *ms)
~MSPolnParse() {cleanup();}
Vector< Int > getPolnIDs(const String &polSpec, Vector< Int > &polIndices)
std::map< Int, Vector< Vector< Int > > > setupMap_p
void setIDLists(const Int key, const Int ndx, Vector< Int > &val)
Vector< Int > getPolnIDsV2(const String &polSpec, Vector< Int > &polTypes)
These are the versions used in the code.
MSPolnParse()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:223
void resize(size_t len, bool copyValues=false)
Definition Vector.h:164
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