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
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 public:
82 // Create a columns object that accesses the data in the specified Table
84
85 // The destructor does nothing special
87
88 // Access to required columns
89 // <group>
112 // </group>
113
114 // Access to optional columns
115 // <group>
122 // </group>
123
124 // Const access to columns
125 // <group>
126 const ArrayColumn<Double>& chanFreq() const { return chanFreq_p; }
129 const ArrayColumn<Double>& chanWidth() const { return chanWidth_p; }
133 const ScalarColumn<Int>& freqGroup() const { return freqGroup_p; }
135 const ScalarColumn<Int>& ifConvChain() const { return ifConvChain_p; }
136 const ScalarColumn<Bool>& flagRow() const { return flagRow_p; }
137 const ScalarColumn<Int>& measFreqRef() const { return measFreqRef_p; }
138 const ScalarColumn<String>& name() const { return name_p; }
139 const ScalarColumn<Int>& netSideband() const { return netSideband_p; }
140 const ScalarColumn<Int>& numChan() const { return numChan_p; }
144 const ArrayColumn<Double>& resolution() const { return resolution_p; }
148 // </group>
149
150 // Const access to optional columns
151 // <group>
153 const ArrayColumn<Int>& assocSpwId() const { return assocSpwId_p; }
154 const ScalarColumn<Int>& bbcNo() const { return bbcNo_p; }
155 const ScalarColumn<Int>& bbcSideband() const { return bbcSideband_p; }
156 const ScalarColumn<Int>& dopplerId() const { return dopplerId_p; }
157 const ScalarColumn<Int>& receiverId() const { return receiverId_p; }
158 // </group>
159
160 // Convenience function that returns the number of rows in any of the columns
161 rownr_t nrow() const { return chanFreq_p.nrow(); }
162
163 // returns the last row that contains a spectral window that has the
164 // specified reference frequency, number of channels, total-bandwidth and IF
165 // conversion chain. All frequencies need to match within the specified
166 // tolerance. Both the totalBandwidth & the tolerance arguments must have the
167 // same dimensions as the Hz and an AipsError exception is thrown, in debug
168 // mode, if the dimensions are wrong. In addition to the numerical values the
169 // frequency reference frame is checked and needs to match the value in the
170 // MEAS_FREQ_REF column. No conversions to other reference frames are
171 // done. Will only try to match on rows where FLAG_ROW is false. If tryRow is
172 // set to a non-negative value then that row is checked first to see if it
173 // matches. An AIpsError exception is thrown if tryRow is bigger than the
174 // number of rows in the Table. Returns -1 if no match could be found.
175 Int64 matchSpw(const MFrequency& refFreq, uInt nChan, const Quantum<Double>& bandwidth,
176 Int ifChain, const Quantum<Double>& tolerance, Int64 tryRow = -1) const;
177 // Similar to above, but also pass in the frame info.
178 Int64 matchSpw(const MFrequency& refFreq, const MFrequency& chanFreq1, const MeasFrame& measFrm,
179 const MSDopplerColumns& msdopc, const MSSourceColumns& mssrcc, uInt nChan,
180 const Quantum<Double>& bandwidth, Int ifChain, const Quantum<Double>& tolerance,
181 Int64 tryRow = -1) const;
182 // This is to check that the channels are matched individually
183 // and also if the spw is matched in reverse;
184
185 // Same as the above but returns all the possible match that it could find
186 // in the spectral window table.
187 RowNumbers allMatchedSpw(const MFrequency& refFreq, uInt nChan, const Quantum<Double>& bandwidth,
188 Int ifChain, const Quantum<Double>& tolerance) const;
189
190 // This version does a channel to channel match too and also return
191 // the reversed if it matches but the channels are in inverse order
192 // like an upper or lower side band having same characteristics
193 Int64 matchSpw(const MFrequency& refFreq, uInt nChan, const Quantum<Double>& bandwidth,
194 Int ifChain, const Quantum<Double>& tolerance, Vector<Double>& otherFreqs,
195 Bool& reversed) const;
196
197 protected:
198 // # default constructor creates a object that is not usable. Use the attach
199 // # function correct this.
201
202 // # attach this object to the supplied table.
203 void attach(const MSSpectralWindow& msSpWindow);
204
205 private:
206 // # Make the assignment operator and the copy constructor private to prevent
207 // # any compiler generated one from being used.
210
211 // # Check if any optional columns exist and if so attach them.
212 void attachOptionalCols(const MSSpectralWindow& msSpWindow);
213
214 // # functions to match the supplied arguments against the values in the
215 // # specified row.
216 //<group>
218 Double tolInHz) const;
219 Bool matchRefFreqCnvtrd(rownr_t row, MFrequency refOrChanFreq, const Bool isRefFreq,
220 const MeasFrame& measFrm, const MSDopplerColumns& msdopc,
221 const MSSourceColumns& mssrcc, Double tolInHz) const;
222 Bool matchChanFreq(rownr_t row, const Vector<Double>& chanFreqInHz, Double tolInHz) const;
223 Bool matchIfConvChain(rownr_t row, Int ifChain) const;
224 Bool matchTotalBandwidth(rownr_t row, Double bandwidthInHz, Double tolInHz) const;
225 Bool matchNumChan(rownr_t row, Int nChan) const;
226 //</group>
227
228 // # required columns
243 // # optional columns
250
251 // # Access to Measure columns
254
255 // # Access to Quantum columns
262};
263
264// # Define the RO version for backward compatibility.
266
267} // namespace casacore
268
269#endif
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:175
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
For temporary backward namespace compatibility, use casa as alias for casacore.
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