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