casacore
Loading...
Searching...
No Matches
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: 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_MSMAINCOLUMNS_H
27#define MS_MSMAINCOLUMNS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/ArrayFwd.h>
31#include <casacore/measures/Measures/MEpoch.h>
32#include <casacore/measures/Measures/Muvw.h>
33#include <casacore/measures/Measures/MCEpoch.h>
34#include <casacore/measures/Measures/MCuvw.h>
35#include <casacore/tables/Tables/ScalarColumn.h>
36#include <casacore/tables/Tables/ArrayColumn.h>
37#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
38#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
39#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
40
41namespace casacore { //# NAMESPACE CASACORE - BEGIN
42
43class MeasurementSet;
44class String;
45
46// <summary>
47// A class for easy access to MeasurementSet main table columns
48// </summary>
49
50// <use visibility=export>
51
52// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
53// </reviewed>
54
55// <prerequisite>
56// <li> MeasurementSet
57// <li> ArrayColumn
58// <li> ScalarColumn
59// </prerequisite>
60//
61// <etymology>
62// MSMainColumns stands for MeasurementSet main Table columns.
63// </etymology>
64//
65// <synopsis>
66// This class provides access to the columns in the MeasurementSet.
67// It does the declaration of all the Scalar and ArrayColumns with the
68// correct types, so the application programmer doesn't have to
69// worry about getting those right. There is an access function
70// for every predefined column. Access to non-predefined columns will still
71// have to be done with explicit declarations.
72// <note role=warning> The Table that is used to construct this class must not
73// be destroyed (or go out of scope) before this class does. Otherwise the
74// scalar and array columns use by this class will be left dangling.</note>
75// </synopsis>
76// </synopsis>
77//
78// <example>
79// <srcblock>
80// // use as follows
81// MeasurementSet ms("myMS",Table::Update);
82// MSColumns msc(ms);
83// // show data from row 5
84// cout << msc.data()(5);
85// // change name of antenna on row 3 in antenna table
86// msc.antenna().name().put(3,"NewAnt-3");
87// </srcblock>
88// </example>
89//
90// <motivation>
91// Having to type long lists of Scalar and Array column declarations gets
92// very tedious. This class attempts to relieve some of that tedium, while
93// at the same time concentrating all the declarations in one place,
94// making Type errors in the column declaration (only caught at run-time) less
95// probable. Type errors in the use of the columns is caught at compile
96// time.
97// </motivation>
98//
99// <todo asof="1997/02/01">
100// <li> We might decide to merge this class with the MeasurementSet
101// </todo>
102
104{
105public:
106
107 // Create a columns object that accesses the data in the specified Table
109
110 // The desctructor does nothing special
112
113 // Access to required columns
114 // <group>
152 // </group>
153
154 // Access to optional columns
155 // <group>
180 // </group>
181
182 // Const access to required columns
183 // <group>
184 const ScalarColumn<Int>& antenna1() const {return antenna1_p;}
185 const ScalarColumn<Int>& antenna2() const {return antenna2_p;}
186 const ScalarColumn<Int>& arrayId() const {return arrayId_p;}
188 const ScalarColumn<Double>& exposure() const {return exposure_p;}
191 const ScalarColumn<Int>& feed1() const {return feed1_p;}
192 const ScalarColumn<Int>& feed2() const {return feed2_p;}
193 const ScalarColumn<Int>& fieldId() const {return fieldId_p;}
194 const ArrayColumn<Bool>& flag() const {return flag_p;}
196 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
197 const ScalarColumn<Double>& interval() const {return interval_p;}
203 const ArrayColumn<Float>& sigma() const {return sigma_p;}
204 const ScalarColumn<Int>& stateId() const {return stateId_p;}
205 const ScalarColumn<Double>& time() const {return time_p;}
207 return timeQuant_p;}
209 return timeMeas_p;}
215 const ArrayColumn<Double>& uvw() const {return uvw_p;}
217 return uvwQuant_p;}
219 return uvwMeas_p;}
220 const ArrayColumn<Float>& weight() const {return weight_p;}
221 // </group>
222
223 // Access to optional columns
224 // <group>
225 const ScalarColumn<Int>& antenna3() const {return antenna3_p;}
228 const ArrayColumn<Complex>& data() const {return data_p;}
229 const ScalarColumn<Int>& feed3() const {return feed3_p;}
230 const ArrayColumn<Float>& floatData() const {return floatData_p;}
232 const ArrayColumn<Complex>& lagData() const {return lagData_p;}
234 const ScalarColumn<Int>& phaseId() const {return phaseId_p;}
235 const ScalarColumn<Int>& pulsarBin() const {return pulsarBin_p;}
241 const ArrayColumn<Double>& uvw2() const {return uvw2_p;}
243 return uvw2Meas_p;}
245 return uvw2Quant_p;}
249 // </group>
250
251 // Convenience function that returns the number of rows in any of the columns
252 rownr_t nrow() const {return antenna1_p.nrow();}
253
254 // Returns the category labels for the FLAG_CATEGORY column.
256
257 // set the epoch type for the TIME and TIME_CENTROID columns.
258 // <note role=tip>
259 // In principle this function can only be used if the table is empty,
260 // otherwise already written values may thereafter have an incorrect
261 // reference, offset, or unit. However, it is possible that part of the
262 // table gets written before these values are known. In that case the
263 // reference, offset, or units can be set by using a False
264 // <src>tableMustBeEmpty</src> argument.
265 // </note>
266 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
267
268 // set the UVW reference type for the UVW and UVW2 (if defined) columns. This
269 // can only be done when the table has no rows. Trying to do so at other
270 // times will throw an exception.
272
273 // Set the flag category labels to the supplied values (in the CATEGORY
274 // keyword of the FLAG_CATEGORY column). Throws an exception, when compiled
275 // in Debug mode, if the length of the supplied Vector is not the same as the
276 // length of the third dimension of the FLAG_CATEGORY column.
277 void setFlagCategories(const Vector<String>& categories);
278
279protected:
280 //# default constructor creates a object that is not usable. Use the attach
281 //# function correct this.
283
284 //# attach this object to the supplied table.
285 void attach(const MeasurementSet& ms);
286
287private:
288 //# Make the assignment operator and the copy constructor private to prevent
289 //# any compiler generated one from being used.
292
293 //# Check if any optional columns exist and if so attach them.
295
296 //# required columns
318 //# optional columns
334
335 //# columns required for synthesis applications - all optional
339
340 //# Access to Measure columns
344 //# optional Measure columns
346
347 //# Access to Quantum columns
353 //# optional Quantum columns
356
357};
358
359//# Define the RO version for backward compatibility.
361
362} //# NAMESPACE CASACORE - END
363
364#endif
365
366
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition MEpoch.h:114
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:127
rownr_t nrow() const
Get the number of rows in the column.
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:40
const Bool True
Definition aipstype.h:41
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44