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/measures/Measures/MEpoch.h>
33 #include <casacore/measures/Measures/Muvw.h>
34 #include <casacore/measures/Measures/MCEpoch.h>
35 #include <casacore/measures/Measures/MCuvw.h>
36 #include <casacore/tables/Tables/ScalarColumn.h>
37 #include <casacore/tables/Tables/ArrayColumn.h>
38 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
39 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
40 #include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 class MeasurementSet;
45 class String;
46 template <class T> class Vector;
47 
48 
49 // <summary>
50 // A class for easy access to MeasurementSet main table 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> MeasurementSet
60 // <li> ArrayColumn
61 // <li> ScalarColumn
62 // </prerequisite>
63 //
64 // <etymology>
65 // MSMainColumns stands for MeasurementSet main Table columns.
66 // </etymology>
67 //
68 // <synopsis>
69 // This class provides access to the columns in the MeasurementSet.
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 // <note role=warning> The Table that is used to construct this class must not
76 // be destroyed (or go out of scope) before this class does. Otherwise the
77 // scalar and array columns use by this class will be left dangling.</note>
78 // </synopsis>
79 // </synopsis>
80 //
81 // <example>
82 // <srcblock>
83 // // use as follows
84 // MeasurementSet ms("myMS",Table::Update);
85 // MSColumns msc(ms);
86 // // show data from row 5
87 // cout << msc.data()(5);
88 // // change name of antenna on row 3 in antenna table
89 // msc.antenna().name().put(3,"NewAnt-3");
90 // </srcblock>
91 // </example>
92 //
93 // <motivation>
94 // Having to type long lists of Scalar and Array column declarations gets
95 // very tedious. This class attempts to relieve some of that tedium, while
96 // at the same time concentrating all the declarations in one place,
97 // making Type errors in the column declaration (only caught at run-time) less
98 // probable. Type errors in the use of the columns is caught at compile
99 // time.
100 // </motivation>
101 //
102 // <todo asof="1997/02/01">
103 // <li> We might decide to merge this class with the MeasurementSet
104 // </todo>
105 
107 {
108 public:
109 
110  // Create a columns object that accesses the data in the specified Table
111  MSMainColumns(const MeasurementSet& ms);
112 
113  // The desctructor does nothing special
114  ~MSMainColumns();
115 
116  // Access to required columns
117  // <group>
124  return exposureQuant_p;}
133  return intervalQuant_p;}
141  return timeQuant_p;}
143  return timeMeas_p;}
146  return timeCentroidQuant_p;}
148  return timeCentroidMeas_p;}
151  return uvwQuant_p;}
153  return uvwMeas_p;}
155  // </group>
156 
157  // Access to optional columns
158  // <group>
174  return timeExtraPrecQuant_p;}
177  return uvw2Meas_p;}
179  return uvw2Quant_p;}
183  // </group>
184 
185  // Const access to required columns
186  // <group>
187  const ScalarColumn<Int>& antenna1() const {return antenna1_p;}
188  const ScalarColumn<Int>& antenna2() const {return antenna2_p;}
189  const ScalarColumn<Int>& arrayId() const {return arrayId_p;}
190  const ScalarColumn<Int>& dataDescId() const {return dataDescId_p;}
191  const ScalarColumn<Double>& exposure() const {return exposure_p;}
193  return exposureQuant_p;}
194  const ScalarColumn<Int>& feed1() const {return feed1_p;}
195  const ScalarColumn<Int>& feed2() const {return feed2_p;}
196  const ScalarColumn<Int>& fieldId() const {return fieldId_p;}
197  const ArrayColumn<Bool>& flag() const {return flag_p;}
199  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
200  const ScalarColumn<Double>& interval() const {return interval_p;}
202  return intervalQuant_p;}
204  const ScalarColumn<Int>& processorId() const {return processorId_p;}
205  const ScalarColumn<Int>& scanNumber() const {return scanNumber_p;}
206  const ArrayColumn<Float>& sigma() const {return sigma_p;}
207  const ScalarColumn<Int>& stateId() const {return stateId_p;}
208  const ScalarColumn<Double>& time() const {return time_p;}
210  return timeQuant_p;}
212  return timeMeas_p;}
215  return timeCentroidQuant_p;}
217  return timeCentroidMeas_p;}
218  const ArrayColumn<Double>& uvw() const {return uvw_p;}
220  return uvwQuant_p;}
222  return uvwMeas_p;}
223  const ArrayColumn<Float>& weight() const {return weight_p;}
224  // </group>
225 
226  // Access to optional columns
227  // <group>
228  const ScalarColumn<Int>& antenna3() const {return antenna3_p;}
231  const ArrayColumn<Complex>& data() const {return data_p;}
232  const ScalarColumn<Int>& feed3() const {return feed3_p;}
233  const ArrayColumn<Float>& floatData() const {return floatData_p;}
235  const ArrayColumn<Complex>& lagData() const {return lagData_p;}
236  const ArrayColumn<Complex>& modelData() const {return modelData_p;}
237  const ScalarColumn<Int>& phaseId() const {return phaseId_p;}
238  const ScalarColumn<Int>& pulsarBin() const {return pulsarBin_p;}
243  return timeExtraPrecQuant_p;}
244  const ArrayColumn<Double>& uvw2() const {return uvw2_p;}
246  return uvw2Meas_p;}
248  return uvw2Quant_p;}
252  // </group>
253 
254  // Convenience function that returns the number of rows in any of the columns
255  uInt nrow() const {return antenna1_p.nrow();}
256 
257  // Returns the category labels for the FLAG_CATEGORY column.
259 
260  // set the epoch type for the TIME and TIME_CENTROID columns.
261  // <note role=tip>
262  // In principle this function can only be used if the table is empty,
263  // otherwise already written values may thereafter have an incorrect
264  // reference, offset, or unit. However, it is possible that part of the
265  // table gets written before these values are known. In that case the
266  // reference, offset, or units can be set by using a False
267  // <src>tableMustBeEmpty</src> argument.
268  // </note>
269  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
270 
271  // set the UVW reference type for the UVW and UVW2 (if defined) columns. This
272  // can only be done when the table has no rows. Trying to do so at other
273  // times will throw an exception.
274  void setUVWRef(Muvw::Types ref);
275 
276  // Set the flag category labels to the supplied values (in the CATEGORY
277  // keyword of the FLAG_CATEGORY column). Throws an exception, when compiled
278  // in Debug mode, if the length of the supplied Vector is not the same as the
279  // length of the third dimension of the FLAG_CATEGORY column.
280  void setFlagCategories(const Vector<String>& categories);
281 
282 protected:
283  //# default constructor creates a object that is not usable. Use the attach
284  //# function correct this.
285  MSMainColumns();
286 
287  //# attach this object to the supplied table.
288  void attach(const MeasurementSet& ms);
289 
290 private:
291  //# Make the assignment operator and the copy constructor private to prevent
292  //# any compiler generated one from being used.
295 
296  //# Check if any optional columns exist and if so attach them.
297  void attachOptionalCols(const MeasurementSet& ms);
298 
299  //# required columns
321  //# optional columns
337 
338  //# columns required for synthesis applications - all optional
342 
343  //# Access to Measure columns
347  //# optional Measure columns
349 
350  //# Access to Quantum columns
356  //# optional Quantum columns
359 
360 };
361 
362 //# Define the RO version for backward compatibility.
364 
365 } //# NAMESPACE CASACORE - END
366 
367 #endif
368 
369 
const ArrayColumn< Float > & weight() const
const ScalarColumn< Int > & scanNumber() const
A 1-D Specialization of the Array class.
Definition: ArrayIO.h:45
ScalarColumn< Double > timeCentroid_p
ArrayColumn< Complex > videoPoint_p
ArrayColumn< Complex > & correctedData()
ScalarColumn< Int > & antenna3()
Access to optional columns.
MSMainColumns ROMSMainColumns
ArrayColumn< Double > uvw_p
ScalarColumn< Double > timeExtraPrec_p
ArrayColumn< Float > weight_p
const ScalarColumn< Double > & timeCentroid() const
ScalarColumn< Double > & time()
ScalarMeasColumn< MEpoch > & timeCentroidMeas()
ScalarColumn< Int > pulsarBin_p
const ScalarColumn< Int > & antenna2() const
ScalarColumn< Double > interval_p
const ArrayColumn< Complex > & modelData() const
ScalarMeasColumn< Muvw > uvwMeas_p
ScalarMeasColumn< Muvw > uvw2Meas_p
ScalarColumn< Int > pulsarGateId_p
ScalarColumn< Int > dataDescId_p
const ScalarColumn< Bool > & baselineRef() const
const ScalarColumn< Double > & time() const
const ScalarQuantColumn< Double > & intervalQuant() const
const ArrayQuantColumn< Double > & uvw2Quant() const
ScalarColumn< Int > & pulsarBin()
ScalarColumn< Int > & pulsarGateId()
const ScalarColumn< Int > & dataDescId() const
ArrayColumn< Float > & weight()
ScalarQuantColumn< Double > intervalQuant_p
const ScalarColumn< Int > & feed1() const
ArrayQuantColumn< Double > uvw2Quant_p
void attachOptionalCols(const MeasurementSet &ms)
ArrayColumn< Complex > & data()
const ArrayColumn< Double > & uvw() const
ScalarColumn< Int > phaseId_p
ArrayQuantColumn< Double > & uvw2Quant()
ScalarColumn< Int > scanNumber_p
ScalarColumn< Double > & exposure()
ArrayColumn< Float > & weightSpectrumCorrected()
MSMainColumns & operator=(const MSMainColumns &)
ScalarQuantColumn< Double > exposureQuant_p
ScalarColumn< Int > & scanNumber()
const ScalarColumn< Int > & antenna3() const
Access to optional columns.
const ArrayColumn< Complex > & data() const
ScalarColumn< Int > antenna1_p
ScalarColumn< Int > stateId_p
const ArrayColumn< Float > & weightSpectrumCorrected() const
Types
Types of known Muvws Warning: The order defines the order in the translation matrix FromTo in the ge...
Definition: Muvw.h:130
const ArrayColumn< Double > & uvw2() 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< Float > weightSpectrumCorrected_p
ScalarMeasColumn< MEpoch > & timeMeas()
const ScalarColumn< Int > & stateId() const
ArrayColumn< Bool > & flagCategory()
const ScalarMeasColumn< MEpoch > & timeCentroidMeas() const
ScalarColumn< Double > & interval()
ArrayColumn< Float > & floatData()
ScalarColumn< Double > exposure_p
ScalarColumn< Int > & antenna2()
const ArrayColumn< Bool > & flag() const
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME and TIME_CENTROID columns.
ArrayQuantColumn< Double > uvwQuant_p
ScalarColumn< Bool > & baselineRef()
const ScalarMeasColumn< Muvw > & uvw2Meas() const
ArrayColumn< Float > & weightSpectrum()
ScalarQuantColumn< Double > & exposureQuant()
const ArrayColumn< Bool > & flagCategory() const
ScalarColumn< Int > arrayId_p
ScalarColumn< Int > & antenna1()
Access to required columns.
const ScalarColumn< Double > & timeExtraPrec() const
void setUVWRef(Muvw::Types ref)
set the UVW reference type for the UVW and UVW2 (if defined) columns.
ScalarQuantColumn< Double > & intervalQuant()
const ScalarColumn< Int > & pulsarBin() const
ScalarColumn< Int > & dataDescId()
ArrayColumn< Float > sigmaSpectrum_p
const ScalarColumn< Int > & processorId() const
ArrayColumn< Complex > & videoPoint()
ScalarMeasColumn< MEpoch > timeCentroidMeas_p
ArrayColumn< Double > & uvw()
Vector< String > flagCategories() const
Returns the category labels for the FLAG_CATEGORY column.
const ScalarColumn< Int > & fieldId() const
ScalarColumn< Int > & feed3()
const ArrayColumn< Complex > & lagData() const
ScalarColumn< Int > & phaseId()
~MSMainColumns()
The desctructor does nothing special.
void attach(const MeasurementSet &ms)
ScalarQuantColumn< Double > timeExtraPrecQuant_p
ScalarColumn< Int > & stateId()
ArrayColumn< Float > & sigma()
ArrayColumn< Bool > flagCategory_p
uInt nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
const ScalarColumn< Double > & exposure() const
ArrayColumn< Complex > correctedData_p
ArrayColumn< Complex > lagData_p
const ArrayQuantColumn< Double > & uvwQuant() const
ArrayColumn< Float > & imagingWeight()
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const ArrayColumn< Float > & imagingWeight() const
const ArrayColumn< Complex > & videoPoint() const
ArrayColumn< Float > sigma_p
const ScalarColumn< Int > & observationId() const
ScalarColumn< Int > observationId_p
const ArrayColumn< Float > & weightSpectrum() const
ScalarColumn< Int > & feed1()
ArrayColumn< Bool > & flag()
ScalarMeasColumn< Muvw > & uvwMeas()
ArrayColumn< Complex > & lagData()
ArrayColumn< Float > imagingWeight_p
ScalarColumn< Int > antenna3_p
const ScalarColumn< Bool > & flagRow() const
ScalarColumn< Int > & processorId()
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
A Table intended to hold astronomical data (a set of Measurements).
ScalarColumn< Int > antenna2_p
ArrayColumn< Complex > modelData_p
ArrayQuantColumn< Double > & uvwQuant()
const ScalarColumn< Int > & pulsarGateId() const
const ScalarColumn< Int > & feed3() const
ScalarQuantColumn< Double > & timeCentroidQuant()
const ScalarColumn< Int > & antenna1() const
Const access to required columns.
ScalarColumn< Int > & feed2()
const ScalarColumn< Int > & arrayId() const
ScalarQuantColumn< Double > & timeQuant()
ScalarQuantColumn< Double > timeQuant_p
ScalarColumn< Bool > flagRow_p
ArrayColumn< Double > uvw2_p
ScalarQuantColumn< Double > & timeExtraPrecQuant()
ScalarMeasColumn< Muvw > & uvw2Meas()
const ScalarQuantColumn< Double > & timeCentroidQuant() const
A class for easy access to MeasurementSet main table columns.
ScalarColumn< Int > & observationId()
ScalarColumn< Int > feed3_p
ScalarColumn< Bool > & flagRow()
const ScalarQuantColumn< Double > & timeQuant() const
ArrayColumn< Complex > & modelData()
ArrayColumn< Double > & uvw2()
const ScalarColumn< Int > & phaseId() const
const ScalarColumn< Int > & feed2() const
ScalarColumn< Int > & fieldId()
const ArrayColumn< Float > & sigma() const
const ScalarMeasColumn< Muvw > & uvwMeas() const
ArrayColumn< Float > floatData_p
ArrayColumn< Bool > flag_p
ArrayColumn< Float > weightSpectrum_p
const ArrayColumn< Float > & sigmaSpectrum() const
ScalarColumn< Double > & timeCentroid()
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarQuantColumn< Double > timeCentroidQuant_p
ArrayColumn< Float > & sigmaSpectrum()
ScalarMeasColumn< MEpoch > timeMeas_p
ScalarColumn< Double > time_p
ScalarColumn< Int > feed1_p
const ArrayColumn< Complex > & correctedData() const
const ArrayColumn< Float > & floatData() const
ScalarColumn< Int > & arrayId()
const ScalarColumn< Double > & interval() const
const Bool True
Definition: aipstype.h:43
const ScalarMeasColumn< MEpoch > & timeMeas() const
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const ScalarQuantColumn< Double > & timeExtraPrecQuant() const
ScalarColumn< Double > & timeExtraPrec()
ScalarColumn< Int > processorId_p
ScalarColumn< Int > fieldId_p
unsigned int uInt
Definition: aipstype.h:51
ScalarColumn< Bool > baselineRef_p
const ScalarQuantColumn< Double > & exposureQuant() const
ScalarColumn< Int > feed2_p
ArrayColumn< Complex > data_p