casacore
MSPointingColumns.h
Go to the documentation of this file.
1 //# MSPointingColumns.h: provides easy access to MSPointing columns
2 //# Copyright (C) 1999,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_MSPOINTINGCOLUMNS_H
29 #define MS_MSPOINTINGCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/measures/Measures/MDirection.h>
33 #include <casacore/measures/Measures/MEpoch.h>
34 #include <casacore/measures/Measures/MCDirection.h>
35 #include <casacore/measures/Measures/MCEpoch.h>
36 #include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
37 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
38 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
39 #include <casacore/tables/Tables/ArrayColumn.h>
40 #include <casacore/tables/Tables/ScalarColumn.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 class MSPointing;
45 
46 // <summary>
47 // A class to provide easy access to MSPointing 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> MSPointing
57 // <li> ArrayColumn
58 // <li> ScalarColumn
59 // </prerequisite>
60 //
61 // <etymology>
62 // MSPointingColumns stands for MeasurementSet Pointing Table columns.
63 // </etymology>
64 //
65 // <synopsis>
66 // This class provides access to the columns in the MSPointing Table,
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 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
73 // </synopsis>
74 //
75 // <motivation>
76 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
77 // </motivation>
78 
80 {
81 public:
82  // Construct from the supplied Table
83  MSPointingColumns(const MSPointing& msPointing);
84 
85  // The destructor does nothing special
87 
88  // Access to required columns
89  //
90  // Note that the direction measures with a stored polynomial have Col() added
91  // to their name. They are better accessed via the functions that have the
92  // same name, without the Col suffix, that will do the interpolation for
93  // you.
94  // <group>
111  // </group>
112 
113  // Access to optional columns
114  //
115  // Note that the direction measures with a stored polynomial have Col() added
116  // to their name. They are better accessed via the functions that have the
117  // same name, without the Col suffix, that will do the interpolation for
118  // you.
119  // <group>
122  return pointingOffsetMeas_p;}
125  return sourceOffsetMeas_p;}
131  // </group>
132 
133  // Const access to required columns
134  // <group>
135  const ScalarColumn<Int>& antennaId() const {return antennaId_p;}
136  const ScalarColumn<Double>& time() const {return time_p;}
139  const ScalarColumn<Double>& interval() const {return interval_p;}
141  return intervalQuant_p;}
142  const ScalarColumn<String>& name() const {return name_p;}
143  const ScalarColumn<Int>& numPoly() const {return numPoly_p;}
146  return timeOriginQuant_p;}
148  return timeOriginMeas_p;}
149  const ArrayColumn<Double>& direction() const {return direction_p;}
151  return directionMeas_p;}
152  const ArrayColumn<Double>& target() const {return target_p;}
154  return targetMeas_p;}
155  const ScalarColumn<Bool>& tracking() const {return tracking_p;}
156  // </group>
157 
158  // Access to optional columns
159  // <group>
161  return pointingOffset_p;}
163  return pointingOffsetMeas_p;}
166  return sourceOffsetMeas_p;}
167  const ArrayColumn<Double>& encoder() const {return encoder_p;}
169  return encoderMeas_p;}
171  return pointingModelId_p;}
172  const ScalarColumn<Bool>& onSource() const {return onSource_p;}
173  const ScalarColumn<Bool>& overTheTop() const {return overTheTop_p;}
174  // </group>
175 
176  // Access to interpolated directions, the default time of zero will
177  // return the 0th order element of the polynomial.
178  // <group>
183  // </group>
184 
185  // return the first matching row index for this time and antenna,
186  // returns -1 if no match was found
187  // For long tables you may give a guess row...the last return
188  // is usually a good one.
189  Int64 pointingIndex(Int antenna, Double time, Int64 guessRow=0) const;
190 
191  // Convenience function that returns the number of rows in any of the columns
192  rownr_t nrow() const {return antennaId_p.nrow();}
193 
194  // set the epoch reference type for the TIME & TIME_ORIGIN column.
195  // <note role=tip>
196  // In principle this function can only be used if the table is empty,
197  // otherwise already written values may thereafter have an incorrect
198  // reference, offset, or unit. However, it is possible that part of the
199  // table gets written before these values are known. In that case the
200  // reference, offset, or units can be set by using a False
201  // <src>tableMustBeEmpty</src> argument.
202  // </note>
203  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
204 
205  // set the direction reference type for the DIRECTION, TARGET & and, if
206  // defined, the SOURCE_OFFSET & POINTING_OFFSET columns. This can only be
207  // done when the table has no rows. Trying to do so at other times will throw
208  // an exception. Note that the optional ENCODER column must be done
209  // separately as the MSv2 definition requires this column to use the frame(s)
210  // of the antenna mounts.
212 
213  // set the direction reference type for the ENCODER column (if it is defined).
214  // This can only be done when the table has no rows. Trying to do so at other
215  // times will throw an exception.
217 
218 protected:
219  //# default constructor creates a object that is not usable. Use the attach
220  //# function correct this.
222 
223  //# attach this object to the supplied table.
224  void attach(const MSPointing& msPointing);
225 
226 private:
227  //# Make the assignment operator and the copy constructor private to prevent
228  //# any compiler generated one from being used.
231 
232  //# Check if any optional columns exist and if so attach them.
233  void attachOptionalCols(const MSPointing& msPointing);
234 
235  //# required columns
245  //# optional columns
252 
253  //# Access to Measure columns
258  //# optional Measure columns
262 
263  //# Access to Quantum columns
267 };
268 
269 //# Define the RO version for backward compatibility.
271 
272 } //# NAMESPACE CASACORE - END
273 
274 #endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
~MSPointingColumns()
The destructor does nothing special.
ScalarColumn< Double > interval_p
MSPointingColumns & operator=(const MSPointingColumns &)
const ScalarColumn< Bool > & tracking() const
ArrayMeasColumn< MDirection > & sourceOffsetMeasCol()
ScalarColumn< Int > numPoly_p
ScalarColumn< Bool > & overTheTop()
ScalarQuantColumn< Double > timeQuant_p
ScalarMeasColumn< MEpoch > & timeOriginMeas()
ArrayColumn< Double > & pointingOffset()
Access to optional columns.
const ScalarQuantColumn< Double > & intervalQuant() const
MDirection targetMeas(rownr_t row, Double time=0) const
ScalarColumn< Bool > & onSource()
const ArrayMeasColumn< MDirection > & targetMeasCol() const
ScalarQuantColumn< Double > & intervalQuant()
ArrayMeasColumn< MDirection > & pointingOffsetMeasCol()
const ScalarColumn< String > & name() const
const ArrayMeasColumn< MDirection > & directionMeasCol() const
ScalarColumn< Bool > & tracking()
MDirection sourceOffsetMeas(rownr_t row, Double time=0) const
ArrayColumn< Double > encoder_p
const ScalarQuantColumn< Double > & timeQuant() const
const ScalarColumn< Int > & antennaId() const
Const access to required columns.
ScalarColumn< Bool > onSource_p
ScalarMeasColumn< MEpoch > & timeMeas()
ArrayColumn< Double > & sourceOffset()
ScalarMeasColumn< MDirection > encoderMeas_p
const ScalarColumn< Bool > & overTheTop() const
const ScalarColumn< Double > & timeOrigin() const
const ScalarColumn< Bool > & onSource() const
ArrayMeasColumn< MDirection > targetMeas_p
ScalarColumn< Int > pointingModelId_p
const ArrayMeasColumn< MDirection > & pointingOffsetMeasCol() const
ScalarColumn< Int > & pointingModelId()
ScalarMeasColumn< MDirection > & encoderMeas()
ScalarColumn< Double > timeOrigin_p
ArrayMeasColumn< MDirection > pointingOffsetMeas_p
ScalarColumn< Double > & interval()
void setDirectionRef(MDirection::Types ref)
set the direction reference type for the DIRECTION, TARGET & and, if defined, the SOURCE_OFFSET & POI...
const ArrayMeasColumn< MDirection > & sourceOffsetMeasCol() const
const ScalarColumn< Double > & interval() const
const ArrayColumn< Double > & sourceOffset() const
const ArrayColumn< Double > & direction() const
ScalarColumn< Double > & timeOrigin()
const ScalarColumn< Int > & numPoly() const
ScalarColumn< String > & name()
const ScalarMeasColumn< MEpoch > & timeOriginMeas() const
ArrayColumn< Double > target_p
const ArrayColumn< Double > & encoder() const
ScalarQuantColumn< Double > & timeQuant()
Int64 pointingIndex(Int antenna, Double time, Int64 guessRow=0) const
return the first matching row index for this time and antenna, returns -1 if no match was found For l...
MSPointingColumns(const MSPointingColumns &)
ArrayColumn< Double > & direction()
void attachOptionalCols(const MSPointing &msPointing)
ScalarColumn< Double > & time()
const ScalarMeasColumn< MDirection > & encoderMeas() const
ScalarQuantColumn< Double > & timeOriginQuant()
const ScalarQuantColumn< Double > & timeOriginQuant() const
ScalarQuantColumn< Double > timeOriginQuant_p
ArrayColumn< Double > sourceOffset_p
const ScalarColumn< Double > & time() const
ScalarColumn< Bool > overTheTop_p
ScalarColumn< Double > time_p
ArrayMeasColumn< MDirection > directionMeas_p
ScalarColumn< Int > antennaId_p
ScalarColumn< String > name_p
const ScalarMeasColumn< MEpoch > & timeMeas() const
void setEncoderDirectionRef(MDirection::Types ref)
set the direction reference type for the ENCODER column (if it is defined).
ScalarColumn< Int > & numPoly()
ScalarMeasColumn< MEpoch > timeOriginMeas_p
MDirection pointingOffsetMeas(rownr_t row, Double time=0) const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
const ScalarColumn< Int > & pointingModelId() const
ArrayColumn< Double > & encoder()
ScalarColumn< Bool > tracking_p
void attach(const MSPointing &msPointing)
ArrayMeasColumn< MDirection > & directionMeasCol()
ScalarColumn< Int > & antennaId()
Access to required columns.
ArrayColumn< Double > & target()
MSPointingColumns(const MSPointing &msPointing)
Construct from the supplied Table.
ArrayMeasColumn< MDirection > sourceOffsetMeas_p
ArrayColumn< Double > pointingOffset_p
const ArrayColumn< Double > & pointingOffset() const
Access to optional columns.
ArrayColumn< Double > direction_p
ArrayMeasColumn< MDirection > & targetMeasCol()
ScalarQuantColumn< Double > intervalQuant_p
const ArrayColumn< Double > & target() const
ScalarMeasColumn< MEpoch > timeMeas_p
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch reference type for the TIME & TIME_ORIGIN column.
MDirection directionMeas(rownr_t row, Double time=0) const
Access to interpolated directions, the default time of zero will return the 0th order element of the ...
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
MSPointingColumns ROMSPointingColumns
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43
double Double
Definition: aipstype.h:55
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46