casacore
Loading...
Searching...
No Matches
MSSpwIndex.h
Go to the documentation of this file.
1//# MSSpwIndex: index or lookup in a MeasurementSet subtable (DDID and SPW)
2//# Copyright (C) 2000,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_MSSPWINDEX_H
27#define MS_MSSPWINDEX_H
28
29//# includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/BasicSL/String.h>
33#include <casacore/ms/MeasurementSets/MSColumns.h>
34#include <casacore/casa/Arrays/Matrix.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# forward declarations
39
40// <summary>
41// Class to handle lookup or indexing into a MS Data_Desc_ID
42// and SpectralWindow subtables
43// </summary>
44
45// <use visibility=export>
46//
47// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48// </reviewed>
49
50// <prerequisite>
51// <li> MeasurementSet
52// </prerequisite>
53//
54// <etymology>
55// From "MeasurementSet", "SpectralWindwo subtable" and "index".
56// </etymology>
57//
58// <synopsis>
59//
60// This class provides lookup and two level indexing into an MS
61// DataDescription and SpectralWindow subtable. These services include
62// returning list of integer data description IDs (DDID), given a list
63// of Spectral window IDs or frequencies. The DDIDs are then used for
64// selecting rows from the MS (since DDIDs are the primary keys in the
65// maintable - not the spectral window IDs).
66//
67// </synopsis>
68//
69// <example>
70// </example>
71//
72// <motivation>
73// Collect together all subtable indexing and lookup for the data
74// description and spectral window subtable, for encapsulation and
75// efficiency.
76// </motivation>
77//
78// <thrown>
79// <li>
80// <li>
81// </thrown>
82//
83
85{
86public:
88
89 // Construct from an MS FIELD subtable
91
92 // Null destructor
93 virtual ~MSSpwIndex() {};
94
95 // Look up FIELD_ID's for a given field name, or set of field names
99
100 Vector<Int> matchFrequencyRange(const Float f0,const Float f1,Bool approx, const Float f3=0);
101
102 // A version of match freq range that does not throw an exception but returns
103 // false if no match...else spw, start, nchan returns the matches
104 // f0 and f1 are in Hz and the match is done in the frame defined in the
105 // SpectralWindow table.
107 Vector<Int>& spw, Vector<Int>& start,
108 Vector<Int>& nchan);
109 // Look up FIELD_ID's for a given pattern/regex for source name/code
111 const Bool regex=False);
112 // Look up FIELD_ID's for a given source id
114
117 Vector<Int> matchGTAndLT(const Int n0, const int n1);
120 Vector<Int> matchGTAndLT(const Float* phyValMin, const Float *phyValMax);
121 Vector<Float> convertToMKS(const Float f0, const Float f1, const String& unit);
123 Int& nFSpec);
125 Int &nFSpec);
126private:
127 Int findChanIndex_p(const Float& freq, const Vector<Double>& chanFreqList,
128 const Bool& greaterThan,
129 const Bool& ascendingOrder);
130 // Construct from an MS FIELD subtable
132 // FIELD subtable column accessor
134 // MSDataDescColumns msDataDescSubTable_p;
137};
138
139
140} //# NAMESPACE CASACORE - END
141
142#endif
143
Vector< Int > matchGT(const Int n)
Bool matchFrequencyRange(const Double f0, const Double f1, Vector< Int > &spw, Vector< Int > &start, Vector< Int > &nchan)
A version of match freq range that does not throw an exception but returns false if no match....
Vector< Int > matchGTAndLT(const Float *phyValMin, const Float *phyValMax)
Vector< Int > matchFrequencyRange(const Float f0, const Float f1, Bool approx, const Float f3=0)
MSSpwIndex(const MSSpectralWindow &msSpw)
Construct from an MS FIELD subtable.
Vector< Int > matchName(const String &name)
Look up FIELD_ID's for a given field name, or set of field names.
Vector< Int > convertToSpwIndex(const Vector< Float > &freqList, Int &nFSpec)
void matchNameAsIntID(Vector< int > &list)
Int findChanIndex_p(const Float &freq, const Vector< Double > &chanFreqList, const Bool &greaterThan, const Bool &ascendingOrder)
Vector< Int > matchName(const Vector< String > &names)
Vector< Int > matchLT(const Int n)
MSSpwIndex()
Construct from an MS FIELD subtable.
Vector< Int > matchRegexOrPattern(const String &pattern, const Bool regex=False)
Look up FIELD_ID's for a given pattern/regex for source name/code.
Vector< Int > matchGTAndLT(const Int n0, const int n1)
MODES
MSDataDescColumns msDataDescSubTable_p;.
Definition MSSpwIndex.h:135
Vector< Float > convertToMKS(const Float f0, const Float f1, const String &unit)
Vector< Int > matchLT(const Float *)
Vector< Int > matchId(const Vector< Int > &spwIds)
Look up FIELD_ID's for a given source id.
MSSpWindowColumns msSpwSubTable_p
FIELD subtable column accessor.
Definition MSSpwIndex.h:133
Vector< Int > matchGT(const Float *)
Vector< Int > spwIDs
Definition MSSpwIndex.h:136
virtual ~MSSpwIndex()
Null destructor.
Definition MSSpwIndex.h:93
Vector< Int > convertToChannelIndex(const Vector< Int > &spw, const Vector< Float > &freqList, Int &nFSpec)
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
TableExprNode pattern(const TableExprNode &node)
Definition ExprNode.h:1491
const Bool False
Definition aipstype.h:42
float Float
Definition aipstype.h:52
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition ExprNode.h:1487
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53