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>
179  MDirection directionMeas(Int row, Double time = 0) const;
180  MDirection targetMeas(Int row, Double time = 0) const;
181  MDirection pointingOffsetMeas(Int row, Double time = 0) const;
182  MDirection sourceOffsetMeas(Int row, Double time = 0) const;
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  Int pointingIndex(Int antenna, Double time, Int guessRow=0) const;
190 
191  // Convenience function that returns the number of rows in any of the columns
192  uInt 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
casacore::MSPointingColumns::intervalQuant
const ScalarQuantColumn< Double > & intervalQuant() const
Definition: MSPointingColumns.h:140
casacore::MSPointingColumns::overTheTop
const ScalarColumn< Bool > & overTheTop() const
Definition: MSPointingColumns.h:173
casacore::MSPointingColumns::direction
ArrayColumn< Double > & direction()
Definition: MSPointingColumns.h:106
casacore::MSPointingColumns::time
ScalarColumn< Double > & time()
Definition: MSPointingColumns.h:96
casacore::MSPointingColumns::directionMeasCol
const ArrayMeasColumn< MDirection > & directionMeasCol() const
Definition: MSPointingColumns.h:150
casacore::MSPointingColumns::name
ScalarColumn< String > & name()
Definition: MSPointingColumns.h:101
casacore::MSPointingColumns::timeOriginMeas_p
ScalarMeasColumn< MEpoch > timeOriginMeas_p
Definition: MSPointingColumns.h:257
casacore::MSPointingColumns::intervalQuant
ScalarQuantColumn< Double > & intervalQuant()
Definition: MSPointingColumns.h:100
casacore::MSPointingColumns::pointingOffsetMeas_p
ArrayMeasColumn< MDirection > pointingOffsetMeas_p
Definition: MSPointingColumns.h:260
casacore::MSPointingColumns::numPoly_p
ScalarColumn< Int > numPoly_p
Definition: MSPointingColumns.h:240
casacore::MSPointingColumns::sourceOffset
ArrayColumn< Double > & sourceOffset()
Definition: MSPointingColumns.h:123
casacore::MSPointingColumns::numPoly
ScalarColumn< Int > & numPoly()
Definition: MSPointingColumns.h:102
casacore::MSPointingColumns::pointingOffsetMeasCol
ArrayMeasColumn< MDirection > & pointingOffsetMeasCol()
Definition: MSPointingColumns.h:121
casacore::MSPointingColumns::tracking_p
ScalarColumn< Bool > tracking_p
Definition: MSPointingColumns.h:244
casacore::MSPointingColumns::targetMeasCol
ArrayMeasColumn< MDirection > & targetMeasCol()
Definition: MSPointingColumns.h:109
casacore::MSPointingColumns::sourceOffsetMeasCol
ArrayMeasColumn< MDirection > & sourceOffsetMeasCol()
Definition: MSPointingColumns.h:124
casacore::MSPointingColumns::target
ArrayColumn< Double > & target()
Definition: MSPointingColumns.h:108
casacore::MSPointingColumns::pointingOffset
const ArrayColumn< Double > & pointingOffset() const
Access to optional columns.
Definition: MSPointingColumns.h:160
casacore::MSPointingColumns::name
const ScalarColumn< String > & name() const
Definition: MSPointingColumns.h:142
casacore::MSPointingColumns::interval_p
ScalarColumn< Double > interval_p
Definition: MSPointingColumns.h:238
casacore::MSPointingColumns::timeOrigin_p
ScalarColumn< Double > timeOrigin_p
Definition: MSPointingColumns.h:243
casacore::MSPointingColumns::targetMeas
MDirection targetMeas(Int row, Double time=0) const
casacore::MSPointingColumns::antennaId
const ScalarColumn< Int > & antennaId() const
Const access to required columns.
Definition: MSPointingColumns.h:135
casacore::MSPointingColumns::directionMeasCol
ArrayMeasColumn< MDirection > & directionMeasCol()
Definition: MSPointingColumns.h:107
casacore::MSPointingColumns::interval
const ScalarColumn< Double > & interval() const
Definition: MSPointingColumns.h:139
casacore::MSPointingColumns::MSPointingColumns
MSPointingColumns()
casacore::MSPointingColumns::sourceOffsetMeas
MDirection sourceOffsetMeas(Int row, Double time=0) const
casacore::ScalarColumn< Int >
casacore::ArrayColumn< Double >
casacore::MSPointingColumns::timeMeas_p
ScalarMeasColumn< MEpoch > timeMeas_p
Definition: MSPointingColumns.h:256
casacore::MSPointingColumns::nrow
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition: MSPointingColumns.h:192
casacore::MSPointingColumns::timeOrigin
ScalarColumn< Double > & timeOrigin()
Definition: MSPointingColumns.h:103
casacore::MSPointingColumns::sourceOffsetMeas_p
ArrayMeasColumn< MDirection > sourceOffsetMeas_p
Definition: MSPointingColumns.h:261
casacore::MSPointingColumns::intervalQuant_p
ScalarQuantColumn< Double > intervalQuant_p
Definition: MSPointingColumns.h:264
casacore::MSPointingColumns::target
const ArrayColumn< Double > & target() const
Definition: MSPointingColumns.h:152
casacore::MSPointingColumns::antennaId
ScalarColumn< Int > & antennaId()
Access to required columns.
Definition: MSPointingColumns.h:95
casacore::MSPointingColumns::pointingModelId
ScalarColumn< Int > & pointingModelId()
Definition: MSPointingColumns.h:128
casacore::MSPointingColumns::antennaId_p
ScalarColumn< Int > antennaId_p
Definition: MSPointingColumns.h:236
casacore::MEpoch::Types
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
casacore::MSPointingColumns::onSource
ScalarColumn< Bool > & onSource()
Definition: MSPointingColumns.h:129
casacore::MSPointingColumns::attachOptionalCols
void attachOptionalCols(const MSPointing &msPointing)
casacore::MSPointingColumns::target_p
ArrayColumn< Double > target_p
Definition: MSPointingColumns.h:241
casacore::MSPointingColumns::sourceOffset_p
ArrayColumn< Double > sourceOffset_p
Definition: MSPointingColumns.h:250
casacore::MSPointingColumns::direction
const ArrayColumn< Double > & direction() const
Definition: MSPointingColumns.h:149
casacore::Double
double Double
Definition: aipstype.h:55
casacore::MSPointingColumns::timeOriginQuant
ScalarQuantColumn< Double > & timeOriginQuant()
Definition: MSPointingColumns.h:104
casacore::MSPointingColumns::onSource_p
ScalarColumn< Bool > onSource_p
Definition: MSPointingColumns.h:247
casacore::ArrayMeasColumn< MDirection >
casacore::MSPointingColumns::pointingOffset
ArrayColumn< Double > & pointingOffset()
Access to optional columns.
Definition: MSPointingColumns.h:120
casacore::MSPointingColumns::sourceOffsetMeasCol
const ArrayMeasColumn< MDirection > & sourceOffsetMeasCol() const
Definition: MSPointingColumns.h:165
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::MSPointingColumns::targetMeasCol
const ArrayMeasColumn< MDirection > & targetMeasCol() const
Definition: MSPointingColumns.h:153
casacore::MSPointingColumns::timeMeas
ScalarMeasColumn< MEpoch > & timeMeas()
Definition: MSPointingColumns.h:97
casacore::MSPointingColumns::~MSPointingColumns
~MSPointingColumns()
The destructor does nothing special.
casacore::MSPointingColumns::tracking
ScalarColumn< Bool > & tracking()
Definition: MSPointingColumns.h:110
casacore::MSPointingColumns::pointingOffsetMeasCol
const ArrayMeasColumn< MDirection > & pointingOffsetMeasCol() const
Definition: MSPointingColumns.h:162
casacore::MSPointingColumns::targetMeas_p
ArrayMeasColumn< MDirection > targetMeas_p
Definition: MSPointingColumns.h:255
casacore::MSPointing
A Table intended to hold a MeasurementSet POINTING table.
Definition: MSPointing.h:78
casacore::MSPointingColumns::setDirectionRef
void setDirectionRef(MDirection::Types ref)
set the direction reference type for the DIRECTION, TARGET & and, if defined, the SOURCE_OFFSET & POI...
casacore::MSPointingColumns::interval
ScalarColumn< Double > & interval()
Definition: MSPointingColumns.h:99
casacore::MSPointingColumns::timeQuant_p
ScalarQuantColumn< Double > timeQuant_p
Definition: MSPointingColumns.h:265
casacore::MSPointingColumns::pointingModelId_p
ScalarColumn< Int > pointingModelId_p
Definition: MSPointingColumns.h:248
casacore::MDirection
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::MSPointingColumns::setEncoderDirectionRef
void setEncoderDirectionRef(MDirection::Types ref)
set the direction reference type for the ENCODER column (if it is defined).
casacore::MSPointingColumns::timeOriginMeas
ScalarMeasColumn< MEpoch > & timeOriginMeas()
Definition: MSPointingColumns.h:105
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::MSPointingColumns::encoderMeas
ScalarMeasColumn< MDirection > & encoderMeas()
Definition: MSPointingColumns.h:127
casacore::MSPointingColumns::sourceOffset
const ArrayColumn< Double > & sourceOffset() const
Definition: MSPointingColumns.h:164
casacore::MSPointingColumns::timeOriginMeas
const ScalarMeasColumn< MEpoch > & timeOriginMeas() const
Definition: MSPointingColumns.h:147
casacore::MSPointingColumns::timeQuant
const ScalarQuantColumn< Double > & timeQuant() const
Definition: MSPointingColumns.h:137
casacore::MSPointingColumns::onSource
const ScalarColumn< Bool > & onSource() const
Definition: MSPointingColumns.h:172
casacore::True
const Bool True
Definition: aipstype.h:43
casacore::ROMSPointingColumns
MSPointingColumns ROMSPointingColumns
Definition: MSPointingColumns.h:270
casacore::MSPointingColumns::encoder
ArrayColumn< Double > & encoder()
Definition: MSPointingColumns.h:126
casacore::MSPointingColumns::numPoly
const ScalarColumn< Int > & numPoly() const
Definition: MSPointingColumns.h:143
casacore::MSPointingColumns::directionMeas_p
ArrayMeasColumn< MDirection > directionMeas_p
Definition: MSPointingColumns.h:254
casacore::MSPointingColumns::directionMeas
MDirection directionMeas(Int row, Double time=0) const
Access to interpolated directions, the default time of zero will return the 0th order element of the ...
casacore::MSPointingColumns::tracking
const ScalarColumn< Bool > & tracking() const
Definition: MSPointingColumns.h:155
casacore::MSPointingColumns::direction_p
ArrayColumn< Double > direction_p
Definition: MSPointingColumns.h:237
casacore::MSPointingColumns::timeOriginQuant_p
ScalarQuantColumn< Double > timeOriginQuant_p
Definition: MSPointingColumns.h:266
casacore::MSPointingColumns::timeOrigin
const ScalarColumn< Double > & timeOrigin() const
Definition: MSPointingColumns.h:144
casacore::MSPointingColumns::pointingOffset_p
ArrayColumn< Double > pointingOffset_p
Definition: MSPointingColumns.h:249
casacore::MSPointingColumns::setEpochRef
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch reference type for the TIME & TIME_ORIGIN column.
casacore::MSPointingColumns::pointingIndex
Int pointingIndex(Int antenna, Double time, Int guessRow=0) const
return the first matching row index for this time and antenna, returns -1 if no match was found For l...
casacore::MSPointingColumns::pointingOffsetMeas
MDirection pointingOffsetMeas(Int row, Double time=0) const
casacore::MSPointingColumns::time_p
ScalarColumn< Double > time_p
Definition: MSPointingColumns.h:242
casacore::ScalarQuantColumn< Double >
casacore::MSPointingColumns::overTheTop_p
ScalarColumn< Bool > overTheTop_p
Definition: MSPointingColumns.h:251
casacore::MSPointingColumns::attach
void attach(const MSPointing &msPointing)
casacore::MSPointingColumns::pointingModelId
const ScalarColumn< Int > & pointingModelId() const
Definition: MSPointingColumns.h:170
casacore::ScalarMeasColumn< MEpoch >
casacore::MSPointingColumns::encoder_p
ArrayColumn< Double > encoder_p
Definition: MSPointingColumns.h:246
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::MSPointingColumns::timeOriginQuant
const ScalarQuantColumn< Double > & timeOriginQuant() const
Definition: MSPointingColumns.h:145
casacore::MDirection::Types
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
casacore::MSPointingColumns::timeMeas
const ScalarMeasColumn< MEpoch > & timeMeas() const
Definition: MSPointingColumns.h:138
casacore::MSPointingColumns::encoder
const ArrayColumn< Double > & encoder() const
Definition: MSPointingColumns.h:167
casacore::MSPointingColumns::encoderMeas_p
ScalarMeasColumn< MDirection > encoderMeas_p
Definition: MSPointingColumns.h:259
casacore::MSPointingColumns::name_p
ScalarColumn< String > name_p
Definition: MSPointingColumns.h:239
casacore::MSPointingColumns::time
const ScalarColumn< Double > & time() const
Definition: MSPointingColumns.h:136
casacore::MSPointingColumns::timeQuant
ScalarQuantColumn< Double > & timeQuant()
Definition: MSPointingColumns.h:98
casacore::MSPointingColumns::encoderMeas
const ScalarMeasColumn< MDirection > & encoderMeas() const
Definition: MSPointingColumns.h:168
casacore::MSPointingColumns::overTheTop
ScalarColumn< Bool > & overTheTop()
Definition: MSPointingColumns.h:130
casacore::MSPointingColumns
A class to provide easy access to MSPointing columns.
Definition: MSPointingColumns.h:79
casacore::MSPointingColumns::operator=
MSPointingColumns & operator=(const MSPointingColumns &)