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