casacore
MSSpWindowColumns.h
Go to the documentation of this file.
1//# MSSpWindowColumns.h: provides easy access to MSSpectralWindow columns
2//# Copyright (C) 1996,1999,2000,2002
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_MSSPWINDOWCOLUMNS_H
29#define MS_MSSPWINDOWCOLUMNS_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/measures/Measures/MFrequency.h>
33#include <casacore/measures/Measures/MCFrequency.h>
34#include <casacore/tables/Tables/ScalarColumn.h>
35#include <casacore/tables/Tables/ArrayColumn.h>
36#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
37#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
38#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
39#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
40#include <casacore/casa/BasicSL/String.h>
41#include <casacore/measures/Measures/MeasFrame.h>
42#include <casacore/ms/MeasurementSets/MSDopplerColumns.h>
43#include <casacore/ms/MeasurementSets/MSSourceColumns.h>
44
45namespace casacore { //# NAMESPACE CASACORE - BEGIN
46
47class MSSpectralWindow;
48
49// <summary>
50// A class to provide easy access to MSSpectralWindow columns
51// </summary>
52
53// <use visibility=export>
54
55// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
56// </reviewed>
57
58// <prerequisite>
59// <li> MSSpectralWindow
60// <li> ArrayColumn
61// <li> ScalarColumn
62// </prerequisite>
63//
64// <etymology>
65// MSSpectralWindowColumns stands for MeasurementSet SpectralWindow Table columns.
66// </etymology>
67//
68// <synopsis>
69// This class provides access to the columns in the MSSpectralWindow Table,
70// it does the declaration of all the Scalar and ArrayColumns with the
71// correct types, so the application programmer doesn't have to
72// worry about getting those right. There is an access function
73// for every predefined column. Access to non-predefined columns will still
74// have to be done with explicit declarations.
75// See <linkto class=MSColumns> MSColumns</linkto> for an example.
76// </synopsis>
77//
78// <motivation>
79// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
80// </motivation>
81
83{
84public:
85 // Create a columns object that accesses the data in the specified Table
87
88 // The destructor does nothing special
90
91 // Access to required columns
92 // <group>
115 return totalBandwidthQuant_p;}
116 // </group>
117
118 // Access to optional columns
119 // <group>
126 // </group>
127
128 // Const access to columns
129 // <group>
130 const ArrayColumn<Double>& chanFreq() const {return chanFreq_p;}
132 return chanFreqQuant_p;}
134 return chanFreqMeas_p;}
137 return chanWidthQuant_p;}
140 return effectiveBWQuant_p;}
141 const ScalarColumn<Int>& freqGroup() const {return freqGroup_p;}
144 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
146 const ScalarColumn<String>& name() const {return name_p;}
148 const ScalarColumn<Int>& numChan() const {return numChan_p;}
151 return refFrequencyQuant_p;}
153 return refFrequencyMeas_p;}
156 return resolutionQuant_p;}
158 return totalBandwidth_p;}
160 return totalBandwidthQuant_p;}
161 // </group>
162
163 // Const access to optional columns
164 // <group>
166 const ArrayColumn<Int>& assocSpwId() const {return assocSpwId_p;}
167 const ScalarColumn<Int>& bbcNo() const {return bbcNo_p;}
169 const ScalarColumn<Int>& dopplerId() const {return dopplerId_p;}
171 // </group>
172
173 // Convenience function that returns the number of rows in any of the columns
174 rownr_t nrow() const {return chanFreq_p.nrow();}
175
176 // returns the last row that contains a spectral window that has the
177 // specified reference frequency, number of channels, total-bandwidth and IF
178 // conversion chain. All frequencies need to match within the specified
179 // tolerance. Both the totalBandwidth & the tolerance arguments must have the
180 // same dimensions as the Hz and an AipsError exception is thrown, in debug
181 // mode, if the dimensions are wrong. In addition to the numerical values the
182 // frequency reference frame is checked and needs to match the value in the
183 // MEAS_FREQ_REF column. No conversions to other reference frames are
184 // done. Will only try to match on rows where FLAG_ROW is false. If tryRow is
185 // set to a non-negative value then that row is checked first to see if it
186 // matches. An AIpsError exception is thrown if tryRow is bigger than the
187 // number of rows in the Table. Returns -1 if no match could be found.
188 Int64 matchSpw(const MFrequency& refFreq, uInt nChan,
189 const Quantum<Double>& bandwidth, Int ifChain,
190 const Quantum<Double>& tolerance, Int64 tryRow=-1) const;
191 // Similar to above, but also pass in the frame info.
192 Int64 matchSpw(const MFrequency& refFreq, const MFrequency& chanFreq1,
193 const MeasFrame& measFrm,
194 const MSDopplerColumns& msdopc, const MSSourceColumns& mssrcc, uInt nChan,
195 const Quantum<Double>& bandwidth, Int ifChain,
196 const Quantum<Double>& tolerance, Int64 tryRow=-1) const;
197 // This is to check that the channels are matched individually
198 // and also if the spw is matched in reverse;
199
200 //Same as the above but returns all the possible match that it could find
201 // in the spectral window table.
202 RowNumbers allMatchedSpw(const MFrequency& refFreq, uInt nChan,
203 const Quantum<Double>& bandwidth, Int ifChain,
204 const Quantum<Double>& tolerance) const;
205
206 //This version does a channel to channel match too and also return
207 // the reversed if it matches but the channels are in inverse order
208 // like an upper or lower side band having same characteristics
209 Int64 matchSpw(const MFrequency& refFreq, uInt nChan,
210 const Quantum<Double>& bandwidth, Int ifChain,
211 const Quantum<Double>& tolerance, Vector<Double>& otherFreqs,
212 Bool& reversed) const;
213
214protected:
215 //# default constructor creates a object that is not usable. Use the attach
216 //# function correct this.
218
219 //# attach this object to the supplied table.
220 void attach(const MSSpectralWindow& msSpWindow);
221
222private:
223 //# Make the assignment operator and the copy constructor private to prevent
224 //# any compiler generated one from being used.
227
228 //# Check if any optional columns exist and if so attach them.
229 void attachOptionalCols(const MSSpectralWindow& msSpWindow);
230
231 //# functions to match the supplied arguments against the values in the
232 //# specified row.
233 //<group>
235 Double refFreqInHz, Double tolInHz) const;
236 Bool matchRefFreqCnvtrd(rownr_t row, MFrequency refOrChanFreq, const Bool isRefFreq,
237 const MeasFrame& measFrm,
238 const MSDopplerColumns& msdopc, const MSSourceColumns& mssrcc,
239 Double tolInHz) const;
240 Bool matchChanFreq(rownr_t row, const Vector<Double>& chanFreqInHz,
241 Double tolInHz) const;
242 Bool matchIfConvChain(rownr_t row, Int ifChain) const;
244 Double tolInHz) const;
245 Bool matchNumChan(rownr_t row, Int nChan) const;
246 //</group>
247
248 //# required columns
263 //# optional columns
270
271 //# Access to Measure columns
274
275 //# Access to Quantum columns
282};
283
284//# Define the RO version for backward compatibility.
286
287} //# NAMESPACE CASACORE - END
288
289#endif
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
ScalarColumn< Int > & measFreqRef()
ScalarColumn< Int > bbcSideband_p
ArrayQuantColumn< Double > & chanFreqQuant()
void attachOptionalCols(const MSSpectralWindow &msSpWindow)
ArrayQuantColumn< Double > chanFreqQuant_p
ScalarColumn< Int > netSideband_p
const ArrayColumn< Double > & chanFreq() const
Const access to columns.
ScalarColumn< Int > & freqGroup()
ScalarQuantColumn< Double > totalBandwidthQuant_p
ArrayQuantColumn< Double > chanWidthQuant_p
RowNumbers allMatchedSpw(const MFrequency &refFreq, uInt nChan, const Quantum< Double > &bandwidth, Int ifChain, const Quantum< Double > &tolerance) const
This is to check that the channels are matched individually and also if the spw is matched in reverse...
ArrayColumn< Double > chanFreq_p
const ScalarColumn< Int > & numChan() const
ArrayQuantColumn< Double > & chanWidthQuant()
ArrayQuantColumn< Double > resolutionQuant_p
Bool matchRefFreqCnvtrd(rownr_t row, MFrequency refOrChanFreq, const Bool isRefFreq, const MeasFrame &measFrm, const MSDopplerColumns &msdopc, const MSSourceColumns &mssrcc, Double tolInHz) const
Int64 matchSpw(const MFrequency &refFreq, const MFrequency &chanFreq1, const MeasFrame &measFrm, const MSDopplerColumns &msdopc, const MSSourceColumns &mssrcc, uInt nChan, const Quantum< Double > &bandwidth, Int ifChain, const Quantum< Double > &tolerance, Int64 tryRow=-1) const
Similar to above, but also pass in the frame info.
ScalarColumn< String > & name()
const ArrayColumn< Double > & chanWidth() const
const ScalarColumn< Int > & bbcNo() const
ScalarColumn< String > freqGroupName_p
ScalarColumn< Int > & receiverId()
const ScalarMeasColumn< MFrequency > & refFrequencyMeas() const
ArrayMeasColumn< MFrequency > & chanFreqMeas()
const ArrayQuantColumn< Double > & chanFreqQuant() const
const ArrayQuantColumn< Double > & resolutionQuant() const
ScalarColumn< Int > & numChan()
ScalarColumn< String > name_p
ArrayColumn< Double > & chanFreq()
Access to required columns.
ScalarColumn< Int > receiverId_p
const ScalarQuantColumn< Double > & totalBandwidthQuant() const
ScalarColumn< Double > & refFrequency()
const ArrayMeasColumn< MFrequency > & chanFreqMeas() const
ScalarColumn< Int > measFreqRef_p
const ScalarColumn< Bool > & flagRow() const
ArrayColumn< String > & assocNature()
Access to optional columns.
MSSpWindowColumns(const MSSpWindowColumns &)
const ScalarColumn< Int > & receiverId() const
ScalarColumn< Int > numChan_p
Bool matchTotalBandwidth(rownr_t row, Double bandwidthInHz, Double tolInHz) const
ArrayColumn< Double > resolution_p
const ScalarColumn< Int > & freqGroup() const
const ArrayQuantColumn< Double > & effectiveBWQuant() const
MSSpWindowColumns(const MSSpectralWindow &msSpWindow)
Create a columns object that accesses the data in the specified Table.
Bool matchNumChan(rownr_t row, Int nChan) const
Int64 matchSpw(const MFrequency &refFreq, uInt nChan, const Quantum< Double > &bandwidth, Int ifChain, const Quantum< Double > &tolerance, Int64 tryRow=-1) const
returns the last row that contains a spectral window that has the specified reference frequency,...
ScalarQuantColumn< Double > refFrequencyQuant_p
ScalarColumn< Double > & totalBandwidth()
ScalarColumn< Int > & dopplerId()
const ScalarColumn< Int > & dopplerId() const
const ScalarColumn< String > & freqGroupName() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarMeasColumn< MFrequency > refFrequencyMeas_p
const ArrayColumn< String > & assocNature() const
Const access to optional columns.
ScalarColumn< Int > & bbcNo()
ArrayColumn< Int > assocSpwId_p
ScalarColumn< Double > refFrequency_p
ArrayColumn< Double > & resolution()
ScalarQuantColumn< Double > & refFrequencyQuant()
ScalarColumn< Int > & bbcSideband()
~MSSpWindowColumns()
The destructor does nothing special.
ScalarColumn< Int > freqGroup_p
ArrayColumn< Double > & chanWidth()
const ArrayColumn< Int > & assocSpwId() const
ScalarColumn< Int > & ifConvChain()
Bool matchRefFrequency(rownr_t row, MFrequency::Types refType, Double refFreqInHz, Double tolInHz) const
const ArrayColumn< Double > & resolution() const
const ScalarColumn< Int > & ifConvChain() const
Int64 matchSpw(const MFrequency &refFreq, uInt nChan, const Quantum< Double > &bandwidth, Int ifChain, const Quantum< Double > &tolerance, Vector< Double > &otherFreqs, Bool &reversed) const
This version does a channel to channel match too and also return the reversed if it matches but the c...
ArrayQuantColumn< Double > & effectiveBWQuant()
const ScalarColumn< String > & name() const
ArrayColumn< Double > & effectiveBW()
const ArrayColumn< Double > & effectiveBW() const
ScalarColumn< String > & freqGroupName()
const ScalarColumn< Int > & measFreqRef() const
ArrayColumn< Double > chanWidth_p
ScalarColumn< Bool > flagRow_p
ScalarColumn< Bool > & flagRow()
ScalarColumn< Int > dopplerId_p
MSSpWindowColumns & operator=(const MSSpWindowColumns &)
ArrayColumn< String > assocNature_p
ArrayColumn< Int > & assocSpwId()
const ArrayQuantColumn< Double > & chanWidthQuant() const
ArrayMeasColumn< MFrequency > chanFreqMeas_p
ScalarColumn< Double > totalBandwidth_p
const ScalarQuantColumn< Double > & refFrequencyQuant() const
Bool matchIfConvChain(rownr_t row, Int ifChain) const
ScalarColumn< Int > & netSideband()
ArrayQuantColumn< Double > effectiveBWQuant_p
ArrayQuantColumn< Double > & resolutionQuant()
ScalarMeasColumn< MFrequency > & refFrequencyMeas()
const ScalarColumn< Int > & bbcSideband() const
void attach(const MSSpectralWindow &msSpWindow)
const ScalarColumn< Double > & totalBandwidth() const
ArrayColumn< Double > effectiveBW_p
Bool matchChanFreq(rownr_t row, const Vector< Double > &chanFreqInHz, Double tolInHz) const
ScalarColumn< Int > ifConvChain_p
ScalarQuantColumn< Double > & totalBandwidthQuant()
const ScalarColumn< Double > & refFrequency() const
const ScalarColumn< Int > & netSideband() const
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
MSSpWindowColumns ROMSSpWindowColumns
double Double
Definition: aipstype.h:55
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46