casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
44 
45 namespace casacore { //# NAMESPACE CASACORE - BEGIN
46 
47 class 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 {
84 public:
85  // Create a columns object that accesses the data in the specified Table
86  MSSpWindowColumns(const MSSpectralWindow& msSpWindow);
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;}
135  const ArrayColumn<Double>& chanWidth() const {return chanWidth_p;}
137  return chanWidthQuant_p;}
140  return effectiveBWQuant_p;}
141  const ScalarColumn<Int>& freqGroup() const {return freqGroup_p;}
143  const ScalarColumn<Int>& ifConvChain() const {return ifConvChain_p;}
144  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
145  const ScalarColumn<Int>& measFreqRef() const {return measFreqRef_p;}
146  const ScalarColumn<String>& name() const {return name_p;}
147  const ScalarColumn<Int>& netSideband() const {return netSideband_p;}
148  const ScalarColumn<Int>& numChan() const {return numChan_p;}
151  return refFrequencyQuant_p;}
153  return refFrequencyMeas_p;}
154  const ArrayColumn<Double>& resolution() const {return resolution_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;}
168  const ScalarColumn<Int>& bbcSideband() const {return bbcSideband_p;}
169  const ScalarColumn<Int>& dopplerId() const {return dopplerId_p;}
170  const ScalarColumn<Int>& receiverId() const {return receiverId_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 
214 protected:
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 
222 private:
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;
243  Bool matchTotalBandwidth(rownr_t row, Double bandwidthInHz,
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
const ScalarQuantColumn< Double > & totalBandwidthQuant() const
ScalarColumn< Int > netSideband_p
const ScalarColumn< Int > & netSideband() const
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
ScalarColumn< Int > & numChan()
int Int
Definition: aipstype.h:50
ArrayQuantColumn< Double > effectiveBWQuant_p
ScalarColumn< Int > & ifConvChain()
ScalarColumn< String > & name()
const ArrayColumn< String > & assocNature() const
Const access to optional columns.
const ArrayQuantColumn< Double > & chanFreqQuant() const
ArrayColumn< String > & assocNature()
Access to optional columns.
ArrayColumn< Double > & resolution()
ArrayQuantColumn< Double > chanWidthQuant_p
ScalarQuantColumn< Double > & totalBandwidthQuant()
ScalarColumn< Int > & bbcSideband()
const ScalarColumn< Int > & numChan() const
ArrayColumn< Double > chanFreq_p
ScalarColumn< Int > & dopplerId()
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...
ArrayQuantColumn< Double > & chanWidthQuant()
Bool matchRefFreqCnvtrd(rownr_t row, MFrequency refOrChanFreq, const Bool isRefFreq, const MeasFrame &measFrm, const MSDopplerColumns &msdopc, const MSSourceColumns &mssrcc, Double tolInHz) const
Bool matchChanFreq(rownr_t row, const Vector< Double > &chanFreqInHz, Double tolInHz) const
ArrayMeasColumn< MFrequency > & chanFreqMeas()
ArrayMeasColumn< MFrequency > chanFreqMeas_p
ScalarMeasColumn< MFrequency > & refFrequencyMeas()
Container for Measure frame.
Definition: MeasFrame.h:137
ScalarColumn< Int > & receiverId()
const ScalarColumn< Int > & freqGroup() const
MSSpWindowColumns & operator=(const MSSpWindowColumns &)
const ArrayColumn< Double > & chanWidth() const
void attachOptionalCols(const MSSpectralWindow &msSpWindow)
ArrayColumn< Double > & chanFreq()
Access to required columns.
const ArrayColumn< Double > & chanFreq() const
Const access to columns.
ScalarColumn< String > & freqGroupName()
ArrayColumn< Double > & chanWidth()
ArrayColumn< Double > resolution_p
Bool matchNumChan(rownr_t row, Int nChan) const
A Measure: wave characteristics.
Definition: MFrequency.h:161
ScalarColumn< Int > & netSideband()
A class to provide easy access to MSSource columns.
ArrayQuantColumn< Double > & chanFreqQuant()
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
ScalarColumn< Int > & freqGroup()
ScalarColumn< String > name_p
ScalarColumn< Int > measFreqRef_p
~MSSpWindowColumns()
The destructor does nothing special.
const ScalarColumn< Double > & refFrequency() const
ScalarColumn< Int > freqGroup_p
const ScalarQuantColumn< Double > & refFrequencyQuant() const
ScalarColumn< Double > & refFrequency()
const ArrayColumn< Double > & effectiveBW() const
const ArrayQuantColumn< Double > & chanWidthQuant() const
Bool matchRefFrequency(rownr_t row, MFrequency::Types refType, Double refFreqInHz, Double tolInHz) const
ScalarColumn< Int > dopplerId_p
double Double
Definition: aipstype.h:55
ArrayColumn< Double > effectiveBW_p
ScalarColumn< Int > receiverId_p
A class to provide easy access to MSSpectralWindow columns.
ScalarColumn< Double > & totalBandwidth()
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarQuantColumn< Double > totalBandwidthQuant_p
MSSpWindowColumns ROMSSpWindowColumns
ScalarColumn< Int > & measFreqRef()
const ScalarColumn< Int > & receiverId() const
const ArrayColumn< Double > & resolution() const
ArrayQuantColumn< Double > resolutionQuant_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ArrayColumn< Double > chanWidth_p
const ScalarColumn< Int > & bbcSideband() const
ScalarColumn< Bool > & flagRow()
A class to provide easy access to MSDoppler columns.
const ArrayColumn< Int > & assocSpwId() const
ScalarQuantColumn< Double > refFrequencyQuant_p
ArrayColumn< Int > assocSpwId_p
const ArrayMeasColumn< MFrequency > & chanFreqMeas() const
Bool matchTotalBandwidth(rownr_t row, Double bandwidthInHz, Double tolInHz) const
const ScalarColumn< Int > & bbcNo() const
const ScalarMeasColumn< MFrequency > & refFrequencyMeas() const
ArrayQuantColumn< Double > & resolutionQuant()
const ArrayQuantColumn< Double > & resolutionQuant() const
ScalarMeasColumn< MFrequency > refFrequencyMeas_p
ScalarColumn< Bool > flagRow_p
ScalarColumn< Double > totalBandwidth_p
void attach(const MSSpectralWindow &msSpWindow)
Bool matchIfConvChain(rownr_t row, Int ifChain) const
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
const ArrayQuantColumn< Double > & effectiveBWQuant() const
const ScalarColumn< Double > & totalBandwidth() const
ArrayColumn< String > assocNature_p
const ScalarColumn< Int > & dopplerId() const
ArrayQuantColumn< Double > chanFreqQuant_p
const ScalarColumn< String > & name() const
const ScalarColumn< String > & freqGroupName() const
const ScalarColumn< Bool > & flagRow() const
ArrayColumn< Int > & assocSpwId()
ScalarQuantColumn< Double > & refFrequencyQuant()
ScalarColumn< Int > numChan_p
ArrayColumn< Double > & effectiveBW()
ScalarColumn< Double > refFrequency_p
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
const ScalarColumn< Int > & measFreqRef() const
ScalarColumn< Int > bbcSideband_p
ScalarColumn< Int > ifConvChain_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...
ArrayQuantColumn< Double > & effectiveBWQuant()
ScalarColumn< Int > & bbcNo()
const ScalarColumn< Int > & ifConvChain() const
unsigned int uInt
Definition: aipstype.h:51
ScalarColumn< String > freqGroupName_p
A Table intended to hold a MeasurementSet SPECTRAL_WINDOW table.