casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 class MSPointing;
45 
46 // <summary>
47 // A class to provide easy read-only 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 // ROMSPointingColumns stands for Read-Only MeasurementSet Pointing Table columns.
63 // </etymology>
64 //
65 // <synopsis>
66 // This class provides read-only access to the columns in the MSPointing
67 // Table. It does the declaration of all the Scalar and ArrayColumns with the
68 // correct types, so the application programmer doesn't have to worry about
69 // getting those right. There is an access function for every predefined
70 // column. Access to non-predefined columns will still have to be done with
71 // explicit declarations. See <linkto class=ROMSColumns>
72 // ROMSColumns</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  // Create a columns object that accesses the data in the specified Table
83  ROMSPointingColumns(const MSPointing& msPointing);
84 
85  // The destructor does nothing special
87 
88  // Access to required columns
89  // <group>
90  const ROScalarColumn<Int>& antennaId() const {return antennaId_p;}
91  const ROScalarColumn<Double>& time() const {return time_p;}
92  const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;}
93  const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;}
94  const ROScalarColumn<Double>& interval() const {return interval_p;}
95  const ROScalarQuantColumn<Double>& intervalQuant() const {
96  return intervalQuant_p;}
97  const ROScalarColumn<String>& name() const {return name_p;}
98  const ROScalarColumn<Int>& numPoly() const {return numPoly_p;}
99  const ROScalarColumn<Double>& timeOrigin() const {return timeOrigin_p;}
100  const ROScalarQuantColumn<Double>& timeOriginQuant() const {
101  return timeOriginQuant_p;}
102  const ROScalarMeasColumn<MEpoch>& timeOriginMeas() const {
103  return timeOriginMeas_p;}
104  const ROArrayColumn<Double>& direction() const {return direction_p;}
105  const ROArrayMeasColumn<MDirection>& directionMeasCol() const {
106  return directionMeas_p;}
107  const ROArrayColumn<Double>& target() const {return target_p;}
108  const ROArrayMeasColumn<MDirection>& targetMeasCol()const {
109  return targetMeas_p;}
110  const ROScalarColumn<Bool>& tracking() const {return tracking_p;}
111  // </group>
112 
113  // Access to optional columns
114  // <group>
115  const ROArrayColumn<Double>& pointingOffset() const {
116  return pointingOffset_p;}
117  const ROArrayMeasColumn<MDirection>& pointingOffsetMeasCol() const {
118  return pointingOffsetMeas_p;}
119  const ROArrayColumn<Double>& sourceOffset() const {return sourceOffset_p;}
120  const ROArrayMeasColumn<MDirection>& sourceOffsetMeasCol() const {
121  return sourceOffsetMeas_p;}
122  const ROArrayColumn<Double>& encoder() const {return encoder_p;}
123  const ROScalarMeasColumn<MDirection>& encoderMeas() const {
124  return encoderMeas_p;}
125  const ROScalarColumn<Int>& pointingModelId() const {
126  return pointingModelId_p;}
127  const ROScalarColumn<Bool>& onSource() const {return onSource_p;}
128  const ROScalarColumn<Bool>& overTheTop() const {return overTheTop_p;}
129  // </group>
130 
131  // Access to interpolated directions, the default time of zero will
132  // return the 0th order element of the polynomial.
133  // <group>
134  MDirection directionMeas(Int row, Double time = 0) const;
135  MDirection targetMeas(Int row, Double time = 0) const;
136  MDirection pointingOffsetMeas(Int row, Double time = 0) const;
137  MDirection sourceOffsetMeas(Int row, Double time = 0) const;
138  // </group>
139 
140  // return the first matching row index for this time and antenna,
141  // returns -1 if no match was found
142  // For long tables you may give a guess row...the last return
143  // is usually a good one.
144  Int pointingIndex(Int antenna, Double time, Int guessRow=0) const;
145 
146  // Convenience function that returns the number of rows in any of the columns
147  uInt nrow() const {return antennaId_p.nrow();}
148 
149 protected:
150  //# default constructor creates a object that is not usable. Use the attach
151  //# function correct this.
153 
154  //# attach this object to the supplied table.
155  void attach(const MSPointing& msPointing);
156 
157 private:
158  //# Make the assignment operator and the copy constructor private to prevent
159  //# any compiler generated one from being used.
162 
163  //# Check if any optional columns exist and if so attach them.
164  void attachOptionalCols(const MSPointing& msPointing);
165 
166  //# required columns
167  ROScalarColumn<Int> antennaId_p;
168  ROArrayColumn<Double> direction_p;
169  ROScalarColumn<Double> interval_p;
170  ROScalarColumn<String> name_p;
171  ROScalarColumn<Int> numPoly_p;
172  ROArrayColumn<Double> target_p;
173  ROScalarColumn<Double> time_p;
174  ROScalarColumn<Double> timeOrigin_p;
175  ROScalarColumn<Bool> tracking_p;
176  //# optional columns
177  ROArrayColumn<Double> encoder_p;
178  ROScalarColumn<Bool> onSource_p;
179  ROScalarColumn<Int> pointingModelId_p;
180  ROArrayColumn<Double> pointingOffset_p;
181  ROArrayColumn<Double> sourceOffset_p;
182  ROScalarColumn<Bool> overTheTop_p;
183 
184  //# Access to Measure columns
185  ROArrayMeasColumn<MDirection> directionMeas_p;
186  ROArrayMeasColumn<MDirection> targetMeas_p;
187  ROScalarMeasColumn<MEpoch> timeMeas_p;
188  ROScalarMeasColumn<MEpoch> timeOriginMeas_p;
189  //# optional Measure columns
190  ROScalarMeasColumn<MDirection> encoderMeas_p;
191  ROArrayMeasColumn<MDirection> pointingOffsetMeas_p;
192  ROArrayMeasColumn<MDirection> sourceOffsetMeas_p;
193 
194  //# Access to Quantum columns
195  ROScalarQuantColumn<Double> intervalQuant_p;
196  ROScalarQuantColumn<Double> timeQuant_p;
197  ROScalarQuantColumn<Double> timeOriginQuant_p;
198 };
199 
200 // <summary>
201 // A class to provide easy read-write access to MSPointing columns
202 // </summary>
203 
204 // <use visibility=export>
205 
206 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
207 // </reviewed>
208 
209 // <prerequisite>
210 // <li> MSPointing
211 // <li> ArrayColumn
212 // <li> ScalarColumn
213 // </prerequisite>
214 //
215 // <etymology>
216 // MSPointingColumns stands for MeasurementSet Pointing Table columns.
217 // </etymology>
218 //
219 // <synopsis>
220 // This class provides access to the columns in the MSPointing Table,
221 // it does the declaration of all the Scalar and ArrayColumns with the
222 // correct types, so the application programmer doesn't have to
223 // worry about getting those right. There is an access function
224 // for every predefined column. Access to non-predefined columns will still
225 // have to be done with explicit declarations.
226 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
227 // </synopsis>
228 //
229 // <motivation>
230 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
231 // </motivation>
232 
234 {
235 public:
236  // Construct from the supplied Table
237  MSPointingColumns(MSPointing& msPointing);
238 
239  // The destructor does nothing special
241 
242  // Read-write access to required columns
243  //
244  // Note that the direction measures with a stored polynomial have Col() added
245  // to their name. They are better accessed via the functions that have the
246  // same name, without the Col suffix, that will do the interpolation for
247  // you. These functions are in the ROMSPointingColumns class.
248  // <group>
265  // </group>
266 
267  // Read-write access to optional columns
268  //
269  // Note that the direction measures with a stored polynomial have Col() added
270  // to their name. They are better accessed via the functions that have the
271  // same name, without the Col suffix, that will do the interpolation for
272  // you. These functions are in the ROMSPointingColumns class.
273  // <group>
276  return pointingOffsetMeas_p;}
279  return sourceOffsetMeas_p;}
285  // </group>
286 
287  // Read-only access to required columns
288  // <group>
289  const ROScalarColumn<Int>& antennaId() const {
291  const ROScalarColumn<Double>& time() const {
292  return ROMSPointingColumns::time();}
293  const ROScalarQuantColumn<Double>& timeQuant() const {
295  const ROScalarMeasColumn<MEpoch>& timeMeas() const {
297  const ROScalarColumn<Double>& interval() const {
299  const ROScalarQuantColumn<Double>& intervalQuant() const {
301  const ROScalarColumn<String>& name() const {
302  return ROMSPointingColumns::name();}
303  const ROScalarColumn<Int>& numPoly() const {
305  const ROScalarColumn<Double>& timeOrigin() const {
307  const ROScalarQuantColumn<Double>& timeOriginQuant() const {
309  const ROScalarMeasColumn<MEpoch>& timeOriginMeas() const {
311  const ROArrayColumn<Double>& direction() const {
313  const ROArrayMeasColumn<MDirection>& directionMeasCol() const {
315  const ROArrayColumn<Double>& target() const {
316  return ROMSPointingColumns::target();}
317  const ROArrayMeasColumn<MDirection>& targetMeasCol()const {
319  const ROScalarColumn<Bool>& tracking() const {
321  // </group>
322 
323  // Access to optional columns
324  // <group>
325  const ROArrayColumn<Double>& pointingOffset() const {
327  const ROArrayMeasColumn<MDirection>& pointingOffsetMeasCol() const {
329  const ROArrayColumn<Double>& sourceOffset() const {
331  const ROArrayMeasColumn<MDirection>& sourceOffsetMeasCol() const {
333  const ROArrayColumn<Double>& encoder() const {
335  const ROScalarMeasColumn<MDirection>& encoderMeas() const {
337  const ROScalarColumn<Int>& pointingModelId() const {
339  const ROScalarColumn<Bool>& onSource() const {
341  const ROScalarColumn<Bool>& overTheTop() const {
343  // </group>
344 
345  // set the epoch reference type for the TIME & TIME_ORIGIN column.
346  // <note role=tip>
347  // In principle this function can only be used if the table is empty,
348  // otherwise already written values may thereafter have an incorrect
349  // reference, offset, or unit. However, it is possible that part of the
350  // table gets written before these values are known. In that case the
351  // reference, offset, or units can be set by using a False
352  // <src>tableMustBeEmpty</src> argument.
353  // </note>
354  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
355 
356  // set the direction reference type for the DIRECTION, TARGET & and, if
357  // defined, the SOURCE_OFFSET & POINTING_OFFSET columns. This can only be
358  // done when the table has no rows. Trying to do so at other times will throw
359  // an exception. Note that the optional ENCODER column must be done
360  // separately as the MSv2 definition requires this column to use the frame(s)
361  // of the antenna mounts.
363 
364  // set the direction reference type for the ENCODER column (if it is defined).
365  // This can only be done when the table has no rows. Trying to do so at other
366  // times will throw an exception.
368 
369 protected:
370  //# default constructor creates a object that is not usable. Use the attach
371  //# function correct this.
373 
374  //# attach this object to the supplied table.
375  void attach(MSPointing& msPointing);
376 
377 private:
378  //# Make the assignment operator and the copy constructor private to prevent
379  //# any compiler generated one from being used.
382 
383  //# Check if any optional columns exist and if so attach them.
384  void attachOptionalCols(MSPointing& msPointing);
385 
386  //# required columns
396  //# optional columns
403 
404  //# Access to Measure columns
409  //# optional Measure columns
413 
414  //# Access to Quantum columns
418 };
419 
420 } //# NAMESPACE CASACORE - END
421 
422 #endif
const ROScalarColumn< Double > & interval() const
ScalarQuantColumn< Double > & intervalQuant()
A Measure: astronomical direction.
Definition: MDirection.h:174
ArrayMeasColumn< MDirection > pointingOffsetMeas_p
const ROArrayColumn< Double > & target() const
ROScalarColumn< Bool > onSource_p
int Int
Definition: aipstype.h:50
ScalarColumn< Int > numPoly_p
const ROScalarColumn< Double > & timeOrigin() const
ScalarColumn< Int > & numPoly()
ArrayMeasColumn< MDirection > & pointingOffsetMeasCol()
ScalarColumn< Bool > tracking_p
ArrayColumn< Double > & direction()
ArrayMeasColumn< MDirection > & targetMeasCol()
ROScalarColumn< Double > time_p
ArrayMeasColumn< MDirection > & sourceOffsetMeasCol()
ROArrayMeasColumn< MDirection > directionMeas_p
ScalarColumn< Double > & time()
ScalarColumn< String > & name()
ScalarMeasColumn< MEpoch > timeOriginMeas_p
void attach(MSPointing &msPointing)
void attachOptionalCols(const MSPointing &msPointing)
ROArrayColumn< Double > target_p
ROScalarColumn< Double > interval_p
ScalarColumn< Double > timeOrigin_p
A Table intended to hold a MeasurementSet POINTING table.
Definition: MSPointing.h:78
ArrayColumn< Double > & sourceOffset()
const ROArrayMeasColumn< MDirection > & sourceOffsetMeasCol() const
const ROArrayMeasColumn< MDirection > & targetMeasCol() const
ROScalarColumn< Int > pointingModelId_p
const ROScalarMeasColumn< MEpoch > & timeMeas() const
ArrayColumn< Double > & target()
const ROScalarMeasColumn< MEpoch > & timeOriginMeas() const
const ROArrayMeasColumn< MDirection > & pointingOffsetMeasCol() const
void attachOptionalCols(MSPointing &msPointing)
ROScalarColumn< Int > numPoly_p
ScalarColumn< Double > interval_p
const ROArrayColumn< Double > & direction() const
ROArrayColumn< Double > pointingOffset_p
const ROScalarQuantColumn< Double > & timeQuant() const
ScalarMeasColumn< MEpoch > timeMeas_p
const ROScalarColumn< Bool > & overTheTop() const
A class to provide easy read-write access to MSPointing columns.
const ROArrayMeasColumn< MDirection > & directionMeasCol() const
const ROScalarQuantColumn< Double > & intervalQuant() const
ScalarColumn< Double > & timeOrigin()
ArrayMeasColumn< MDirection > & directionMeasCol()
ArrayMeasColumn< MDirection > sourceOffsetMeas_p
ROArrayMeasColumn< MDirection > sourceOffsetMeas_p
MDirection sourceOffsetMeas(Int row, Double time=0) const
ROMSPointingColumns & operator=(const ROMSPointingColumns &)
const ROScalarMeasColumn< MDirection > & encoderMeas() const
const ROScalarMeasColumn< MEpoch > & timeOriginMeas() const
const ROScalarColumn< Int > & antennaId() const
Access to required columns.
const ROScalarColumn< Int > & numPoly() const
ScalarColumn< Int > & pointingModelId()
const ROArrayColumn< Double > & pointingOffset() const
Access to optional columns.
const ROScalarColumn< Bool > & onSource() const
ROArrayColumn< Double > direction_p
ArrayColumn< Double > target_p
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
const ROArrayColumn< Double > & encoder() const
ROScalarQuantColumn< Double > timeQuant_p
ROArrayMeasColumn< MDirection > targetMeas_p
ScalarColumn< Bool > onSource_p
const ROScalarColumn< Bool > & tracking() const
const ROScalarQuantColumn< Double > & timeQuant() const
ScalarQuantColumn< Double > intervalQuant_p
ROScalarMeasColumn< MEpoch > timeOriginMeas_p
const ROScalarColumn< String > & name() const
const ROArrayMeasColumn< MDirection > & sourceOffsetMeasCol() const
ScalarColumn< Int > & antennaId()
Read-write access to required columns.
ScalarColumn< Int > antennaId_p
ScalarColumn< Bool > & onSource()
const ROScalarColumn< Double > & timeOrigin() const
ArrayColumn< Double > sourceOffset_p
A class to provide easy read-only access to MSPointing columns.
ScalarQuantColumn< Double > & timeOriginQuant()
~MSPointingColumns()
The destructor does nothing special.
MDirection pointingOffsetMeas(Int row, Double time=0) const
ScalarColumn< Bool > & tracking()
double Double
Definition: aipstype.h:55
ArrayMeasColumn< MDirection > targetMeas_p
ScalarColumn< Double > & interval()
ArrayColumn< Double > & pointingOffset()
Read-write access to optional columns.
void setDirectionRef(MDirection::Types ref)
set the direction reference type for the DIRECTION, TARGET &amp; and, if defined, the SOURCE_OFFSET &amp; POI...
ScalarQuantColumn< Double > timeQuant_p
ROScalarColumn< String > name_p
ROScalarQuantColumn< Double > timeOriginQuant_p
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarMeasColumn< MEpoch > & timeMeas()
const ROArrayColumn< Double > & target() const
const ROScalarQuantColumn< Double > & timeOriginQuant() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ROScalarColumn< Double > timeOrigin_p
ROScalarColumn< Bool > overTheTop_p
ScalarColumn< Int > pointingModelId_p
void setEncoderDirectionRef(MDirection::Types ref)
set the direction reference type for the ENCODER column (if it is defined).
ScalarMeasColumn< MEpoch > & timeOriginMeas()
ScalarQuantColumn< Double > timeOriginQuant_p
const ROScalarColumn< Double > & interval() const
const ROScalarQuantColumn< Double > & intervalQuant() const
ScalarMeasColumn< MDirection > & encoderMeas()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch reference type for the TIME &amp; TIME_ORIGIN column.
ROScalarColumn< Int > antennaId_p
ROArrayColumn< Double > sourceOffset_p
const ROArrayColumn< Double > & pointingOffset() const
Access to optional columns.
ROArrayMeasColumn< MDirection > pointingOffsetMeas_p
ScalarColumn< Double > time_p
ROArrayColumn< Double > encoder_p
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 ...
ArrayColumn< Double > & encoder()
const ROScalarColumn< Bool > & overTheTop() const
ArrayMeasColumn< MDirection > directionMeas_p
const ROArrayMeasColumn< MDirection > & targetMeasCol() const
ROScalarMeasColumn< MEpoch > timeMeas_p
const ROScalarColumn< Double > & time() const
const ROArrayColumn< Double > & encoder() const
const ROArrayColumn< Double > & direction() const
const ROScalarColumn< Int > & antennaId() const
Read-only access to required columns.
ArrayColumn< Double > direction_p
ArrayColumn< Double > pointingOffset_p
ArrayColumn< Double > encoder_p
const ROScalarMeasColumn< MDirection > & encoderMeas() const
void attach(const MSPointing &msPointing)
const ROScalarColumn< String > & name() const
const ROArrayColumn< Double > & sourceOffset() const
const ROScalarQuantColumn< Double > & timeOriginQuant() const
const ROScalarColumn< Bool > & onSource() const
const ROArrayColumn< Double > & sourceOffset() const
ScalarColumn< Bool > overTheTop_p
const ROScalarColumn< Int > & pointingModelId() const
~ROMSPointingColumns()
The destructor does nothing special.
const ROScalarColumn< Int > & pointingModelId() const
ScalarColumn< Bool > & overTheTop()
ROScalarMeasColumn< MDirection > encoderMeas_p
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
const ROArrayMeasColumn< MDirection > & pointingOffsetMeasCol() const
ROScalarColumn< Bool > tracking_p
ScalarMeasColumn< MDirection > encoderMeas_p
const ROScalarColumn< Double > & time() const
MSPointingColumns & operator=(const MSPointingColumns &)
ScalarColumn< String > name_p
MDirection targetMeas(Int row, Double time=0) const
const Bool True
Definition: aipstype.h:43
const ROScalarColumn< Int > & numPoly() const
const ROScalarMeasColumn< MEpoch > & timeMeas() const
const ROArrayMeasColumn< MDirection > & directionMeasCol() const
const ROScalarColumn< Bool > & tracking() const
ScalarQuantColumn< Double > & timeQuant()
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...
ROScalarQuantColumn< Double > intervalQuant_p
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42