casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 //#
27 //# $Id$
28 
29 #ifndef MS_MSSPWINDEX_H
30 #define MS_MSSPWINDEX_H
31 
32 //# includes
33 #include <casacore/casa/aips.h>
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# forward declarations
42 
43 // <summary>
44 // Class to handle lookup or indexing into a MS Data_Desc_ID
45 // and SpectralWindow subtables
46 // </summary>
47 
48 // <use visibility=export>
49 //
50 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
51 // </reviewed>
52 
53 // <prerequisite>
54 // <li> MeasurementSet
55 // </prerequisite>
56 //
57 // <etymology>
58 // From "MeasurementSet", "SpectralWindwo subtable" and "index".
59 // </etymology>
60 //
61 // <synopsis>
62 //
63 // This class provides lookup and two level indexing into an MS
64 // DataDescription and SpectralWindow subtable. These services include
65 // returning list of integer data description IDs (DDID), given a list
66 // of Spectral window IDs or frequencies. The DDIDs are then used for
67 // selecting rows from the MS (since DDIDs are the primary keys in the
68 // maintable - not the spectral window IDs).
69 //
70 // </synopsis>
71 //
72 // <example>
73 // </example>
74 //
75 // <motivation>
76 // Collect together all subtable indexing and lookup for the data
77 // description and spectral window subtable, for encapsulation and
78 // efficiency.
79 // </motivation>
80 //
81 // <thrown>
82 // <li>
83 // <li>
84 // </thrown>
85 //
86 
87 class MSSpwIndex
88 {
89 public:
91 
92  // Construct from an MS FIELD subtable
93  MSSpwIndex(const MSSpectralWindow& msSpw);
94 
95  // Null destructor
96  virtual ~MSSpwIndex() {};
97 
98  // Look up FIELD_ID's for a given field name, or set of field names
100  Vector<Int> matchName(const Vector<String>& names);
101  void matchNameAsIntID(Vector<int>& list);
102 
103  Vector<Int> matchFrequencyRange(const Float f0,const Float f1,Bool approx, const Float f3=0);
104 
105  // A version of match freq range that does not throw an exception but returns
106  // false if no match...else spw, start, nchan returns the matches
107  // f0 and f1 are in Hz and the match is done in the frame defined in the
108  // SpectralWindow table.
109  Bool matchFrequencyRange(const Double f0, const Double f1,
110  Vector<Int>& spw, Vector<Int>& start,
111  Vector<Int>& nchan);
112  // Look up FIELD_ID's for a given pattern/regex for source name/code
114  const Bool regex=False);
115  // Look up FIELD_ID's for a given source id
116  Vector<Int> matchId(const Vector<Int>& spwIds);
117 
118  Vector<Int> matchLT(const Int n);
119  Vector<Int> matchGT(const Int n);
120  Vector<Int> matchGTAndLT(const Int n0, const int n1);
121  Vector<Int> matchLT(const Float*);
122  Vector<Int> matchGT(const Float*);
123  Vector<Int> matchGTAndLT(const Float* phyValMin, const Float *phyValMax);
124  Vector<Float> convertToMKS(const Float f0, const Float f1, const String& unit);
125  Vector<Int> convertToChannelIndex(const Vector<Int>& spw, const Vector<Float>& freqList,
126  Int& nFSpec);
128  Int &nFSpec);
129 private:
130  Int findChanIndex_p(const Float& freq, const Vector<Double>& chanFreqList,
131  const Bool& greaterThan,
132  const Bool& ascendingOrder);
133  // Construct from an MS FIELD subtable
134  MSSpwIndex();
135  // FIELD subtable column accessor
137  // ROMSDataDescColumns msDataDescSubTable_p;
138  enum MODES {EXACT=1, APPROX, RANGE};
140 };
141 
142 
143 } //# NAMESPACE CASACORE - END
144 
145 #endif
146 
Vector< Int > matchFrequencyRange(const Float f0, const Float f1, Bool approx, const Float f3=0)
MSSpwIndex()
Construct from an MS FIELD subtable.
int Int
Definition: aipstype.h:50
Int findChanIndex_p(const Float &freq, const Vector< Double > &chanFreqList, const Bool &greaterThan, const Bool &ascendingOrder)
void matchNameAsIntID(Vector< int > &list)
Vector< Int > convertToChannelIndex(const Vector< Int > &spw, const Vector< Float > &freqList, Int &nFSpec)
Vector< Int > matchRegexOrPattern(const String &pattern, const Bool regex=False)
Look up FIELD_ID&#39;s for a given pattern/regex for source name/code.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
A class to provide easy read-only access to MSASpectralWindow columns.
Vector< Int > matchGTAndLT(const Int n0, const int n1)
TableExprNode pattern(const TableExprNode &node)
Definition: ExprNode.h:1444
ROMSSpWindowColumns msSpwSubTable_p
FIELD subtable column accessor.
Definition: MSSpwIndex.h:136
MODES
ROMSDataDescColumns msDataDescSubTable_p;.
Definition: MSSpwIndex.h:138
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
Vector< Float > convertToMKS(const Float f0, const Float f1, const String &unit)
const Bool False
Definition: aipstype.h:44
Vector< Int > spwIDs
Definition: MSSpwIndex.h:139
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1440
virtual ~MSSpwIndex()
Null destructor.
Definition: MSSpwIndex.h:96
Class to handle lookup or indexing into a MS Data_Desc_ID and SpectralWindow subtables.
Definition: MSSpwIndex.h:87
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Vector< Int > convertToSpwIndex(const Vector< Float > &freqList, Int &nFSpec)
Vector< Int > matchGT(const Int n)
Vector< Int > matchId(const Vector< Int > &spwIds)
Look up FIELD_ID&#39;s for a given source id.
Vector< Int > matchName(const String &name)
Look up FIELD_ID&#39;s for a given field name, or set of field names.
Vector< Int > matchLT(const Int n)
A Table intended to hold a MeasurementSet SPECTRAL_WINDOW table.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42