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 
43 namespace casacore { //# NAMESPACE CASACORE - BEGIN
44 
45 class MeasurementSet;
46 class 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 {
107 public:
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;}
189  const ScalarColumn<Int>& dataDescId() const {return dataDescId_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;}
203  const ScalarColumn<Int>& processorId() const {return processorId_p;}
204  const ScalarColumn<Int>& scanNumber() const {return scanNumber_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;}
235  const ArrayColumn<Complex>& modelData() const {return modelData_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 
281 protected:
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 
289 private:
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
const ScalarColumn< Int > & pulsarGateId() const
const ArrayColumn< Float > & imagingWeight() const
const ArrayQuantColumn< Double > & uvw2Quant() const
const ScalarColumn< Int > & antenna1() const
Const access to required columns.
ScalarMeasColumn< Muvw > & uvwMeas()
ScalarColumn< Int > & arrayId()
ArrayColumn< Complex > data_p
const ScalarMeasColumn< Muvw > & uvwMeas() const
ScalarColumn< Int > dataDescId_p
ScalarColumn< Int > & pulsarBin()
ArrayColumn< Float > sigmaSpectrum_p
ScalarColumn< Int > & stateId()
ScalarColumn< Int > & phaseId()
const ScalarColumn< Int > & arrayId() const
const ScalarColumn< Int > & scanNumber() const
ScalarColumn< Double > time_p
ScalarMeasColumn< Muvw > uvwMeas_p
const ScalarColumn< Int > & feed3() const
ScalarColumn< Int > & antenna2()
Vector< String > flagCategories() const
Returns the category labels for the FLAG_CATEGORY column.
void attachOptionalCols(const MeasurementSet &ms)
ScalarColumn< Bool > baselineRef_p
ScalarColumn< Bool > & baselineRef()
ArrayColumn< Double > & uvw2()
const ArrayColumn< Float > & weightSpectrum() const
ArrayColumn< Float > & floatData()
const ScalarColumn< Int > & fieldId() const
ScalarColumn< Int > & feed3()
ScalarColumn< Double > & exposure()
ScalarColumn< Int > & antenna1()
Access to required columns.
ScalarQuantColumn< Double > timeExtraPrecQuant_p
ScalarQuantColumn< Double > exposureQuant_p
const ScalarColumn< Bool > & flagRow() const
MSMainColumns(const MeasurementSet &ms)
Create a columns object that accesses the data in the specified Table.
ScalarMeasColumn< MEpoch > timeCentroidMeas_p
ArrayColumn< Complex > videoPoint_p
const ScalarColumn< Int > & observationId() const
ScalarColumn< Int > & scanNumber()
ScalarColumn< Int > & processorId()
ScalarQuantColumn< Double > & timeExtraPrecQuant()
ScalarColumn< Int > antenna3_p
const ScalarColumn< Double > & time() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Int > & fieldId()
ArrayColumn< Double > uvw_p
ScalarMeasColumn< Muvw > & uvw2Meas()
ArrayColumn< Float > weightSpectrum_p
const ArrayColumn< Float > & floatData() const
ScalarMeasColumn< MEpoch > & timeMeas()
ArrayColumn< Bool > flag_p
ScalarQuantColumn< Double > & timeCentroidQuant()
ArrayColumn< Bool > & flag()
ScalarColumn< Int > processorId_p
ScalarColumn< Double > & time()
const ArrayColumn< Complex > & videoPoint() const
ScalarMeasColumn< MEpoch > timeMeas_p
ArrayQuantColumn< Double > & uvwQuant()
ArrayColumn< Complex > modelData_p
const ScalarColumn< Bool > & baselineRef() const
ArrayColumn< Float > & weight()
const ScalarColumn< Int > & feed1() const
const ScalarColumn< Double > & timeExtraPrec() const
const ScalarMeasColumn< MEpoch > & timeMeas() const
ScalarColumn< Int > stateId_p
const ScalarColumn< Int > & stateId() const
ArrayColumn< Complex > & data()
MSMainColumns(const MSMainColumns &)
const ScalarColumn< Int > & antenna3() const
Access to optional columns.
ArrayColumn< Float > imagingWeight_p
const ScalarColumn< Int > & pulsarBin() const
const ScalarQuantColumn< Double > & intervalQuant() const
ScalarQuantColumn< Double > & intervalQuant()
MSMainColumns & operator=(const MSMainColumns &)
const ScalarColumn< Double > & interval() const
ScalarQuantColumn< Double > intervalQuant_p
const ScalarColumn< Double > & exposure() const
ScalarColumn< Int > & antenna3()
Access to optional columns.
const ArrayColumn< Float > & sigma() const
ArrayColumn< Bool > flagCategory_p
const ArrayColumn< Bool > & flag() const
void setUVWRef(Muvw::Types ref)
set the UVW reference type for the UVW and UVW2 (if defined) columns.
ScalarColumn< Int > arrayId_p
const ArrayColumn< Float > & weight() const
ScalarColumn< Int > feed2_p
const ArrayColumn< Double > & uvw() const
ArrayColumn< Float > floatData_p
const ScalarColumn< Int > & antenna2() const
const ScalarMeasColumn< Muvw > & uvw2Meas() const
ArrayColumn< Complex > & lagData()
ScalarColumn< Int > antenna1_p
ScalarColumn< Int > feed3_p
ArrayColumn< Complex > & correctedData()
const ScalarQuantColumn< Double > & timeExtraPrecQuant() const
ScalarColumn< Double > & timeCentroid()
ScalarColumn< Double > exposure_p
ScalarColumn< Int > & feed1()
ArrayColumn< Float > weight_p
ArrayColumn< Bool > & flagCategory()
const ScalarColumn< Int > & processorId() const
ArrayColumn< Complex > lagData_p
const ScalarQuantColumn< Double > & timeQuant() const
ScalarColumn< Double > & timeExtraPrec()
ScalarColumn< Int > & pulsarGateId()
ScalarColumn< Int > observationId_p
ScalarColumn< Double > & interval()
ScalarQuantColumn< Double > & exposureQuant()
const ScalarColumn< Double > & timeCentroid() const
const ScalarColumn< Int > & feed2() const
ScalarColumn< Int > pulsarGateId_p
ScalarColumn< Int > & observationId()
ScalarColumn< Int > antenna2_p
const ArrayColumn< Complex > & lagData() const
ArrayColumn< Double > uvw2_p
const ArrayColumn< Float > & sigmaSpectrum() const
const ScalarColumn< Int > & dataDescId() const
ArrayColumn< Float > & imagingWeight()
const ArrayColumn< Float > & weightSpectrumCorrected() const
const ArrayColumn< Complex > & data() const
ScalarColumn< Int > feed1_p
ArrayQuantColumn< Double > & uvw2Quant()
ScalarColumn< Int > scanNumber_p
const ScalarQuantColumn< Double > & timeCentroidQuant() const
const ArrayColumn< Complex > & modelData() const
void setFlagCategories(const Vector< String > &categories)
Set the flag category labels to the supplied values (in the CATEGORY keyword of the FLAG_CATEGORY col...
ArrayColumn< Complex > & videoPoint()
ScalarColumn< Bool > & flagRow()
ArrayColumn< Float > sigma_p
ArrayColumn< Double > & uvw()
ScalarColumn< Bool > flagRow_p
ArrayColumn< Float > weightSpectrumCorrected_p
ScalarMeasColumn< MEpoch > & timeCentroidMeas()
ArrayQuantColumn< Double > uvw2Quant_p
const ScalarMeasColumn< MEpoch > & timeCentroidMeas() const
ArrayQuantColumn< Double > uvwQuant_p
ArrayColumn< Float > & sigmaSpectrum()
ScalarQuantColumn< Double > timeQuant_p
ScalarColumn< Int > fieldId_p
ArrayColumn< Float > & weightSpectrumCorrected()
const ArrayColumn< Bool > & flagCategory() const
ScalarColumn< Double > timeExtraPrec_p
ArrayColumn< Complex > correctedData_p
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME and TIME_CENTROID columns.
ArrayColumn< Float > & weightSpectrum()
~MSMainColumns()
The desctructor does nothing special.
ArrayColumn< Float > & sigma()
ScalarColumn< Int > pulsarBin_p
const ScalarColumn< Int > & phaseId() const
ScalarQuantColumn< Double > & timeQuant()
ScalarColumn< Int > & feed2()
const ArrayQuantColumn< Double > & uvwQuant() const
ScalarColumn< Double > interval_p
const ArrayColumn< Complex > & correctedData() const
ArrayColumn< Complex > & modelData()
const ScalarQuantColumn< Double > & exposureQuant() const
const ArrayColumn< Double > & uvw2() const
ScalarQuantColumn< Double > timeCentroidQuant_p
ScalarColumn< Int > & dataDescId()
void attach(const MeasurementSet &ms)
ScalarMeasColumn< Muvw > uvw2Meas_p
ScalarColumn< Double > timeCentroid_p
ScalarColumn< Int > phaseId_p
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