casacore
MSMainColumns.h
Go to the documentation of this file.
1//# MSmainColumns.h: provides easy access to MeasurementSet main table columns
2//# Copyright (C) 2000
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_MSMAINCOLUMNS_H
29#define MS_MSMAINCOLUMNS_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/ArrayFwd.h>
33#include <casacore/measures/Measures/MEpoch.h>
34#include <casacore/measures/Measures/Muvw.h>
35#include <casacore/measures/Measures/MCEpoch.h>
36#include <casacore/measures/Measures/MCuvw.h>
37#include <casacore/tables/Tables/ScalarColumn.h>
38#include <casacore/tables/Tables/ArrayColumn.h>
39#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
40#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
41#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
42
43namespace casacore { //# NAMESPACE CASACORE - BEGIN
44
45class MeasurementSet;
46class String;
47
48// <summary>
49// A class for easy access to MeasurementSet main table columns
50// </summary>
51
52// <use visibility=export>
53
54// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
55// </reviewed>
56
57// <prerequisite>
58// <li> MeasurementSet
59// <li> ArrayColumn
60// <li> ScalarColumn
61// </prerequisite>
62//
63// <etymology>
64// MSMainColumns stands for MeasurementSet main Table columns.
65// </etymology>
66//
67// <synopsis>
68// This class provides access to the columns in the MeasurementSet.
69// It does the declaration of all the Scalar and ArrayColumns with the
70// correct types, so the application programmer doesn't have to
71// worry about getting those right. There is an access function
72// for every predefined column. Access to non-predefined columns will still
73// have to be done with explicit declarations.
74// <note role=warning> The Table that is used to construct this class must not
75// be destroyed (or go out of scope) before this class does. Otherwise the
76// scalar and array columns use by this class will be left dangling.</note>
77// </synopsis>
78// </synopsis>
79//
80// <example>
81// <srcblock>
82// // use as follows
83// MeasurementSet ms("myMS",Table::Update);
84// MSColumns msc(ms);
85// // show data from row 5
86// cout << msc.data()(5);
87// // change name of antenna on row 3 in antenna table
88// msc.antenna().name().put(3,"NewAnt-3");
89// </srcblock>
90// </example>
91//
92// <motivation>
93// Having to type long lists of Scalar and Array column declarations gets
94// very tedious. This class attempts to relieve some of that tedium, while
95// at the same time concentrating all the declarations in one place,
96// making Type errors in the column declaration (only caught at run-time) less
97// probable. Type errors in the use of the columns is caught at compile
98// time.
99// </motivation>
100//
101// <todo asof="1997/02/01">
102// <li> We might decide to merge this class with the MeasurementSet
103// </todo>
104
106{
107public:
108
109 // Create a columns object that accesses the data in the specified Table
111
112 // The desctructor does nothing special
114
115 // Access to required columns
116 // <group>
123 return exposureQuant_p;}
132 return intervalQuant_p;}
140 return timeQuant_p;}
142 return timeMeas_p;}
145 return timeCentroidQuant_p;}
147 return timeCentroidMeas_p;}
150 return uvwQuant_p;}
152 return uvwMeas_p;}
154 // </group>
155
156 // Access to optional columns
157 // <group>
173 return timeExtraPrecQuant_p;}
176 return uvw2Meas_p;}
178 return uvw2Quant_p;}
182 // </group>
183
184 // Const access to required columns
185 // <group>
186 const ScalarColumn<Int>& antenna1() const {return antenna1_p;}
187 const ScalarColumn<Int>& antenna2() const {return antenna2_p;}
188 const ScalarColumn<Int>& arrayId() const {return arrayId_p;}
190 const ScalarColumn<Double>& exposure() const {return exposure_p;}
192 return exposureQuant_p;}
193 const ScalarColumn<Int>& feed1() const {return feed1_p;}
194 const ScalarColumn<Int>& feed2() const {return feed2_p;}
195 const ScalarColumn<Int>& fieldId() const {return fieldId_p;}
196 const ArrayColumn<Bool>& flag() const {return flag_p;}
198 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
199 const ScalarColumn<Double>& interval() const {return interval_p;}
201 return intervalQuant_p;}
205 const ArrayColumn<Float>& sigma() const {return sigma_p;}
206 const ScalarColumn<Int>& stateId() const {return stateId_p;}
207 const ScalarColumn<Double>& time() const {return time_p;}
209 return timeQuant_p;}
211 return timeMeas_p;}
214 return timeCentroidQuant_p;}
216 return timeCentroidMeas_p;}
217 const ArrayColumn<Double>& uvw() const {return uvw_p;}
219 return uvwQuant_p;}
221 return uvwMeas_p;}
222 const ArrayColumn<Float>& weight() const {return weight_p;}
223 // </group>
224
225 // Access to optional columns
226 // <group>
227 const ScalarColumn<Int>& antenna3() const {return antenna3_p;}
230 const ArrayColumn<Complex>& data() const {return data_p;}
231 const ScalarColumn<Int>& feed3() const {return feed3_p;}
232 const ArrayColumn<Float>& floatData() const {return floatData_p;}
234 const ArrayColumn<Complex>& lagData() const {return lagData_p;}
236 const ScalarColumn<Int>& phaseId() const {return phaseId_p;}
237 const ScalarColumn<Int>& pulsarBin() const {return pulsarBin_p;}
242 return timeExtraPrecQuant_p;}
243 const ArrayColumn<Double>& uvw2() const {return uvw2_p;}
245 return uvw2Meas_p;}
247 return uvw2Quant_p;}
251 // </group>
252
253 // Convenience function that returns the number of rows in any of the columns
254 rownr_t nrow() const {return antenna1_p.nrow();}
255
256 // Returns the category labels for the FLAG_CATEGORY column.
258
259 // set the epoch type for the TIME and TIME_CENTROID columns.
260 // <note role=tip>
261 // In principle this function can only be used if the table is empty,
262 // otherwise already written values may thereafter have an incorrect
263 // reference, offset, or unit. However, it is possible that part of the
264 // table gets written before these values are known. In that case the
265 // reference, offset, or units can be set by using a False
266 // <src>tableMustBeEmpty</src> argument.
267 // </note>
268 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
269
270 // set the UVW reference type for the UVW and UVW2 (if defined) columns. This
271 // can only be done when the table has no rows. Trying to do so at other
272 // times will throw an exception.
274
275 // Set the flag category labels to the supplied values (in the CATEGORY
276 // keyword of the FLAG_CATEGORY column). Throws an exception, when compiled
277 // in Debug mode, if the length of the supplied Vector is not the same as the
278 // length of the third dimension of the FLAG_CATEGORY column.
279 void setFlagCategories(const Vector<String>& categories);
280
281protected:
282 //# default constructor creates a object that is not usable. Use the attach
283 //# function correct this.
285
286 //# attach this object to the supplied table.
287 void attach(const MeasurementSet& ms);
288
289private:
290 //# Make the assignment operator and the copy constructor private to prevent
291 //# any compiler generated one from being used.
294
295 //# Check if any optional columns exist and if so attach them.
297
298 //# required columns
320 //# optional columns
336
337 //# columns required for synthesis applications - all optional
341
342 //# Access to Measure columns
346 //# optional Measure columns
348
349 //# Access to Quantum columns
355 //# optional Quantum columns
358
359};
360
361//# Define the RO version for backward compatibility.
363
364} //# NAMESPACE CASACORE - END
365
366#endif
367
368
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarColumn< Int > & dataDescId()
ArrayColumn< Complex > data_p
ScalarColumn< Int > dataDescId_p
const ScalarQuantColumn< Double > & timeQuant() const
ArrayColumn< Complex > & videoPoint()
ArrayColumn< Float > sigmaSpectrum_p
ScalarColumn< Double > & timeCentroid()
const ScalarColumn< Int > & observationId() const
ScalarMeasColumn< MEpoch > & timeCentroidMeas()
ScalarColumn< Double > time_p
ScalarMeasColumn< Muvw > uvwMeas_p
const ScalarColumn< Int > & feed2() const
const ScalarColumn< Bool > & flagRow() const
void attachOptionalCols(const MeasurementSet &ms)
const ArrayQuantColumn< Double > & uvwQuant() const
ScalarColumn< Bool > baselineRef_p
Vector< String > flagCategories() const
Returns the category labels for the FLAG_CATEGORY column.
const ArrayColumn< Complex > & correctedData() const
ArrayQuantColumn< Double > & uvwQuant()
ScalarColumn< Int > & pulsarGateId()
const ScalarColumn< Double > & interval() const
ScalarQuantColumn< Double > timeExtraPrecQuant_p
const ArrayColumn< Float > & sigmaSpectrum() const
ScalarQuantColumn< Double > exposureQuant_p
MSMainColumns(const MeasurementSet &ms)
Create a columns object that accesses the data in the specified Table.
const ArrayColumn< Bool > & flag() const
ScalarMeasColumn< MEpoch > timeCentroidMeas_p
ArrayColumn< Complex > videoPoint_p
ArrayColumn< Float > & weight()
const ScalarColumn< Int > & processorId() const
ArrayColumn< Double > & uvw()
ScalarColumn< Int > antenna3_p
const ScalarColumn< Double > & exposure() const
const ScalarColumn< Bool > & baselineRef() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ArrayColumn< Double > uvw_p
ArrayColumn< Float > & imagingWeight()
const ArrayColumn< Double > & uvw2() const
ArrayColumn< Float > weightSpectrum_p
ArrayColumn< Float > & weightSpectrumCorrected()
const ArrayColumn< Float > & floatData() const
ArrayColumn< Bool > flag_p
const ScalarQuantColumn< Double > & exposureQuant() const
ArrayColumn< Bool > & flag()
const ScalarColumn< Int > & arrayId() const
ScalarColumn< Int > processorId_p
const ArrayColumn< Float > & sigma() const
ScalarMeasColumn< MEpoch > timeMeas_p
ArrayColumn< Float > & floatData()
ScalarMeasColumn< Muvw > & uvw2Meas()
const ArrayColumn< Complex > & videoPoint() const
ArrayColumn< Complex > modelData_p
ArrayColumn< Float > & sigmaSpectrum()
const ScalarColumn< Int > & feed3() const
const ScalarQuantColumn< Double > & intervalQuant() const
ScalarColumn< Bool > & baselineRef()
const ScalarColumn< Double > & timeCentroid() const
ScalarQuantColumn< Double > & timeExtraPrecQuant()
ScalarColumn< Double > & time()
MSMainColumns & operator=(const MSMainColumns &)
ScalarColumn< Int > & observationId()
ScalarColumn< Int > stateId_p
ScalarColumn< Int > & scanNumber()
MSMainColumns(const MSMainColumns &)
ScalarColumn< Double > & exposure()
ArrayColumn< Float > imagingWeight_p
ScalarColumn< Int > & stateId()
ArrayColumn< Complex > & correctedData()
ScalarQuantColumn< Double > & exposureQuant()
ScalarColumn< Int > & pulsarBin()
ScalarQuantColumn< Double > intervalQuant_p
const ScalarColumn< Int > & fieldId() const
const ScalarColumn< Int > & antenna2() const
ScalarColumn< Int > & feed1()
const ScalarColumn< Int > & phaseId() const
ArrayColumn< Bool > flagCategory_p
ScalarColumn< Int > & phaseId()
void setUVWRef(Muvw::Types ref)
set the UVW reference type for the UVW and UVW2 (if defined) columns.
ScalarColumn< Int > arrayId_p
const ScalarMeasColumn< Muvw > & uvwMeas() const
ScalarColumn< Double > & timeExtraPrec()
ScalarColumn< Int > feed2_p
ArrayColumn< Float > floatData_p
ScalarColumn< Int > & feed3()
ScalarQuantColumn< Double > & intervalQuant()
const ArrayColumn< Float > & imagingWeight() const
ScalarColumn< Int > antenna1_p
ScalarColumn< Int > feed3_p
ScalarColumn< Int > & antenna1()
Access to required columns.
ScalarColumn< Bool > & flagRow()
ScalarColumn< Double > exposure_p
ArrayColumn< Complex > & modelData()
ArrayColumn< Float > weight_p
ScalarColumn< Int > & arrayId()
ArrayColumn< Float > & weightSpectrum()
ArrayColumn< Bool > & flagCategory()
const ArrayColumn< Float > & weight() const
const ArrayColumn< Complex > & modelData() const
ScalarMeasColumn< Muvw > & uvwMeas()
const ScalarQuantColumn< Double > & timeCentroidQuant() const
ArrayColumn< Complex > lagData_p
const ScalarMeasColumn< MEpoch > & timeCentroidMeas() const
const ScalarColumn< Double > & timeExtraPrec() const
ScalarQuantColumn< Double > & timeCentroidQuant()
ScalarColumn< Int > observationId_p
const ArrayColumn< Float > & weightSpectrumCorrected() const
ScalarQuantColumn< Double > & timeQuant()
const ArrayColumn< Complex > & lagData() const
const ScalarColumn< Int > & pulsarGateId() const
const ArrayQuantColumn< Double > & uvw2Quant() const
const ScalarMeasColumn< Muvw > & uvw2Meas() const
ScalarColumn< Int > pulsarGateId_p
ScalarColumn< Int > antenna2_p
const ScalarMeasColumn< MEpoch > & timeMeas() const
ArrayColumn< Double > uvw2_p
ScalarColumn< Int > feed1_p
ScalarColumn< Int > scanNumber_p
void setFlagCategories(const Vector< String > &categories)
Set the flag category labels to the supplied values (in the CATEGORY keyword of the FLAG_CATEGORY col...
const ArrayColumn< Double > & uvw() const
ArrayColumn< Double > & uvw2()
ArrayColumn< Float > & sigma()
ScalarColumn< Int > & antenna2()
const ArrayColumn< Float > & weightSpectrum() const
ArrayColumn< Float > sigma_p
ArrayColumn< Complex > & data()
ScalarColumn< Bool > flagRow_p
ArrayColumn< Float > weightSpectrumCorrected_p
ArrayQuantColumn< Double > uvw2Quant_p
ArrayQuantColumn< Double > uvwQuant_p
ScalarColumn< Int > & fieldId()
ScalarColumn< Int > & antenna3()
Access to optional columns.
ScalarQuantColumn< Double > timeQuant_p
const ScalarColumn< Int > & feed1() const
ScalarColumn< Int > fieldId_p
const ScalarColumn< Int > & dataDescId() const
const ArrayColumn< Complex > & data() const
ScalarMeasColumn< MEpoch > & timeMeas()
ScalarColumn< Double > timeExtraPrec_p
const ArrayColumn< Bool > & flagCategory() const
ArrayColumn< Complex > correctedData_p
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME and TIME_CENTROID columns.
~MSMainColumns()
The desctructor does nothing special.
ScalarColumn< Int > pulsarBin_p
const ScalarColumn< Int > & antenna3() const
Access to optional columns.
ScalarColumn< Int > & processorId()
ArrayQuantColumn< Double > & uvw2Quant()
const ScalarColumn< Int > & scanNumber() const
const ScalarColumn< Int > & pulsarBin() const
ScalarColumn< Double > interval_p
const ScalarColumn< Double > & time() const
const ScalarQuantColumn< Double > & timeExtraPrecQuant() const
const ScalarColumn< Int > & antenna1() const
Const access to required columns.
ScalarQuantColumn< Double > timeCentroidQuant_p
void attach(const MeasurementSet &ms)
ScalarMeasColumn< Muvw > uvw2Meas_p
ScalarColumn< Int > & feed2()
ScalarColumn< Double > timeCentroid_p
const ScalarColumn< Int > & stateId() const
ScalarColumn< Double > & interval()
ScalarColumn< Int > phaseId_p
ArrayColumn< Complex > & lagData()
Types
Types of known Muvws Warning: The order defines the order in the translation matrix FromTo in the ge...
Definition: Muvw.h:130
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
MSMainColumns ROMSMainColumns
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46