casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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
110  MSMainColumns(const MeasurementSet& ms);
111 
112  // The desctructor does nothing special
113  ~MSMainColumns();
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.
273  void setUVWRef(Muvw::Types ref);
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.
284  MSMainColumns();
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.
296  void attachOptionalCols(const MeasurementSet& ms);
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 
const ArrayColumn< Complex > & data() const
const ArrayColumn< Complex > & modelData() const
const ScalarColumn< Int > & antenna1() const
Const access to required columns.
Vector< String > flagCategories() const
Returns the category labels for the FLAG_CATEGORY column.
A 1-D Specialization of the Array class.
Definition: ArrayFwd.h:9
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
ScalarColumn< Double > & time()
const ScalarColumn< Int > & phaseId() const
const ScalarColumn< Double > & exposure() const
ScalarMeasColumn< MEpoch > & timeCentroidMeas()
const ScalarMeasColumn< Muvw > & uvw2Meas() const
ScalarColumn< Int > pulsarBin_p
ScalarColumn< Double > interval_p
ScalarMeasColumn< Muvw > uvwMeas_p
ScalarMeasColumn< Muvw > uvw2Meas_p
ScalarColumn< Int > pulsarGateId_p
ScalarColumn< Int > dataDescId_p
const ScalarQuantColumn< Double > & timeCentroidQuant() const
const ScalarColumn< Int > & scanNumber() const
const ScalarColumn< Int > & dataDescId() const
ScalarColumn< Int > & pulsarBin()
ScalarColumn< Int > & pulsarGateId()
const ArrayQuantColumn< Double > & uvwQuant() const
ArrayColumn< Float > & weight()
ScalarQuantColumn< Double > intervalQuant_p
ArrayQuantColumn< Double > uvw2Quant_p
void attachOptionalCols(const MeasurementSet &ms)
ArrayColumn< Complex > & data()
ScalarColumn< Int > phaseId_p
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
const ArrayColumn< Float > & weight() const
ArrayQuantColumn< Double > & uvw2Quant()
ScalarColumn< Int > scanNumber_p
ScalarColumn< Double > & exposure()
const ScalarQuantColumn< Double > & exposureQuant() const
ArrayColumn< Float > & weightSpectrumCorrected()
const ScalarColumn< Int > & feed3() const
MSMainColumns & operator=(const MSMainColumns &)
const ArrayColumn< Float > & weightSpectrumCorrected() const
ScalarQuantColumn< Double > exposureQuant_p
const ArrayColumn< Complex > & correctedData() const
ScalarColumn< Int > & scanNumber()
const ArrayColumn< Double > & uvw2() const
ScalarColumn< Int > antenna1_p
ScalarColumn< Int > stateId_p
Types
Types of known Muvws Warning: The order defines the order in the translation matrix FromTo in the ge...
Definition: Muvw.h:130
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 ArrayColumn< Complex > & videoPoint() const
const ScalarColumn< Double > & timeCentroid() const
const ScalarColumn< Int > & arrayId() const
ArrayColumn< Bool > & flagCategory()
const ArrayColumn< Float > & floatData() const
ScalarColumn< Double > & interval()
ArrayColumn< Float > & floatData()
ScalarColumn< Double > exposure_p
ScalarColumn< Int > & antenna2()
const ScalarColumn< Double > & interval() 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()
ArrayColumn< Float > & weightSpectrum()
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
ScalarQuantColumn< Double > & exposureQuant()
ScalarColumn< Int > arrayId_p
ScalarColumn< Int > & antenna1()
Access to required columns.
void setUVWRef(Muvw::Types ref)
set the UVW reference type for the UVW and UVW2 (if defined) columns.
ScalarQuantColumn< Double > & intervalQuant()
ScalarColumn< Int > & dataDescId()
ArrayColumn< Float > sigmaSpectrum_p
ArrayColumn< Complex > & videoPoint()
ScalarMeasColumn< MEpoch > timeCentroidMeas_p
const ArrayColumn< Bool > & flag() const
const ScalarColumn< Int > & feed2() const
ArrayColumn< Double > & uvw()
const ScalarMeasColumn< MEpoch > & timeMeas() const
const ArrayColumn< Bool > & flagCategory() const
const ScalarColumn< Double > & timeExtraPrec() const
ScalarColumn< Int > & feed3()
ScalarColumn< Int > & phaseId()
~MSMainColumns()
The desctructor does nothing special.
void attach(const MeasurementSet &ms)
ScalarQuantColumn< Double > timeExtraPrecQuant_p
ScalarColumn< Int > & stateId()
const ScalarColumn< Bool > & flagRow() const
ArrayColumn< Float > & sigma()
ArrayColumn< Bool > flagCategory_p
const ScalarMeasColumn< Muvw > & uvwMeas() const
ArrayColumn< Complex > correctedData_p
ArrayColumn< Complex > lagData_p
const ArrayColumn< Complex > & lagData() const
const ArrayColumn< Float > & imagingWeight() const
ArrayColumn< Float > & imagingWeight()
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const ScalarQuantColumn< Double > & timeQuant() const
ArrayColumn< Float > sigma_p
const ScalarColumn< Int > & stateId() const
const ArrayQuantColumn< Double > & uvw2Quant() const
ScalarColumn< Int > observationId_p
const ScalarColumn< Int > & feed1() const
ScalarColumn< Int > & feed1()
const ArrayColumn< Double > & uvw() const
ArrayColumn< Bool > & flag()
ScalarMeasColumn< Muvw > & uvwMeas()
ArrayColumn< Complex > & lagData()
ArrayColumn< Float > imagingWeight_p
ScalarColumn< Int > antenna3_p
ScalarColumn< Int > & processorId()
A Table intended to hold astronomical data (a set of Measurements).
ScalarColumn< Int > antenna2_p
ArrayColumn< Complex > modelData_p
ArrayQuantColumn< Double > & uvwQuant()
const ScalarQuantColumn< Double > & intervalQuant() const
ScalarQuantColumn< Double > & timeCentroidQuant()
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
ScalarColumn< Int > & feed2()
ScalarQuantColumn< Double > & timeQuant()
ScalarQuantColumn< Double > timeQuant_p
const ScalarColumn< Int > & fieldId() const
ScalarColumn< Bool > flagRow_p
ArrayColumn< Double > uvw2_p
ScalarQuantColumn< Double > & timeExtraPrecQuant()
ScalarMeasColumn< Muvw > & uvw2Meas()
const ScalarColumn< Int > & processorId() const
const ScalarMeasColumn< MEpoch > & timeCentroidMeas() const
A class for easy access to MeasurementSet main table columns.
ScalarColumn< Int > & observationId()
ScalarColumn< Int > feed3_p
const ScalarColumn< Int > & antenna3() const
Access to optional columns.
ScalarColumn< Bool > & flagRow()
const ScalarColumn< Bool > & baselineRef() const
const ArrayColumn< Float > & sigma() const
ArrayColumn< Complex > & modelData()
ArrayColumn< Double > & uvw2()
const ScalarColumn< Int > & observationId() const
ScalarColumn< Int > & fieldId()
ArrayColumn< Float > floatData_p
ArrayColumn< Bool > flag_p
ArrayColumn< Float > weightSpectrum_p
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
const ScalarColumn< Int > & antenna2() const
ScalarColumn< Double > time_p
const ScalarColumn< Int > & pulsarGateId() const
const ScalarQuantColumn< Double > & timeExtraPrecQuant() const
ScalarColumn< Int > feed1_p
ScalarColumn< Int > & arrayId()
const Bool True
Definition: aipstype.h:43
const ArrayColumn< Float > & weightSpectrum() const
ScalarColumn< Double > & timeExtraPrec()
ScalarColumn< Int > processorId_p
ScalarColumn< Int > fieldId_p
const ScalarColumn< Double > & time() const
const ScalarColumn< Int > & pulsarBin() const
ScalarColumn< Bool > baselineRef_p
const ArrayColumn< Float > & sigmaSpectrum() const
ScalarColumn< Int > feed2_p
ArrayColumn< Complex > data_p