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: 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>
34#include <casacore/casa/Arrays/Vector.h>
35#include <casacore/casa/BasicSL/String.h>
36#include <casacore/ms/MeasurementSets/MSColumns.h>
37#include <casacore/casa/Arrays/Matrix.h>
38
39namespace 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
88{
89public:
91
92 // Construct from an MS FIELD subtable
94
95 // Null destructor
96 virtual ~MSSpwIndex() {};
97
98 // Look up FIELD_ID's for a given field name, or set of field names
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.
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
117
120 Vector<Int> matchGTAndLT(const Int n0, const int n1);
123 Vector<Int> matchGTAndLT(const Float* phyValMin, const Float *phyValMax);
124 Vector<Float> convertToMKS(const Float f0, const Float f1, const String& unit);
126 Int& nFSpec);
128 Int &nFSpec);
129private:
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
135 // FIELD subtable column accessor
137 // MSDataDescColumns msDataDescSubTable_p;
140};
141
142
143} //# NAMESPACE CASACORE - END
144
145#endif
146
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:138
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:136
Vector< Int > matchGT(const Float *)
Vector< Int > spwIDs
Definition MSSpwIndex.h:139
virtual ~MSSpwIndex()
Null destructor.
Definition MSSpwIndex.h:96
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:225
this file contains all the compiler specific defines
Definition mainpage.dox:28
TableExprNode pattern(const TableExprNode &node)
Definition ExprNode.h:1487
const Bool False
Definition aipstype.h:44
float Float
Definition aipstype.h:54
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition ExprNode.h:1483
int Int
Definition aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:42
double Double
Definition aipstype.h:55