casacore
 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 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(rownr_t row, Double time = 0) const;
180  MDirection targetMeas(rownr_t 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  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
ScalarQuantColumn< Double > & intervalQuant()
const ScalarColumn< Double > & time() const
A Measure: astronomical direction.
Definition: MDirection.h:174
const ScalarColumn< Bool > & tracking() const
ArrayMeasColumn< MDirection > pointingOffsetMeas_p
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
ScalarColumn< Int > numPoly_p
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...
ScalarColumn< Int > & numPoly()
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ArrayMeasColumn< MDirection > & pointingOffsetMeasCol()
const ArrayMeasColumn< MDirection > & targetMeasCol() const
ScalarColumn< Bool > tracking_p
ArrayColumn< Double > & direction()
ArrayMeasColumn< MDirection > & targetMeasCol()
ArrayMeasColumn< MDirection > & sourceOffsetMeasCol()
ScalarColumn< Double > & time()
ScalarColumn< String > & name()
ScalarMeasColumn< MEpoch > timeOriginMeas_p
const ArrayColumn< Double > & pointingOffset() const
Access to optional columns.
const ScalarQuantColumn< Double > & intervalQuant() const
ScalarColumn< Double > timeOrigin_p
A Table intended to hold a MeasurementSet POINTING table.
Definition: MSPointing.h:78
ArrayColumn< Double > & sourceOffset()
ArrayColumn< Double > & target()
ScalarColumn< Double > interval_p
ScalarMeasColumn< MEpoch > timeMeas_p
A class to provide easy access to MSPointing columns.
ScalarColumn< Double > & timeOrigin()
ArrayMeasColumn< MDirection > & directionMeasCol()
MDirection pointingOffsetMeas(rownr_t row, Double time=0) const
ArrayMeasColumn< MDirection > sourceOffsetMeas_p
const ScalarColumn< Double > & timeOrigin() const
const ArrayColumn< Double > & direction() const
ScalarColumn< Int > & pointingModelId()
MDirection sourceOffsetMeas(rownr_t row, Double time=0) const
void attachOptionalCols(const MSPointing &msPointing)
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 ArrayMeasColumn< MDirection > & sourceOffsetMeasCol() const
ScalarColumn< Bool > onSource_p
ScalarQuantColumn< Double > intervalQuant_p
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
const ArrayMeasColumn< MDirection > & directionMeasCol() const
ScalarColumn< Int > & antennaId()
Access to required columns.
ScalarColumn< Int > antennaId_p
ScalarColumn< Bool > & onSource()
const ScalarColumn< Int > & antennaId() const
Const access to required columns.
ArrayColumn< Double > sourceOffset_p
ScalarQuantColumn< Double > & timeOriginQuant()
~MSPointingColumns()
The destructor does nothing special.
ScalarColumn< Bool > & tracking()
MSPointingColumns ROMSPointingColumns
double Double
Definition: aipstype.h:55
ArrayMeasColumn< MDirection > targetMeas_p
const ScalarColumn< String > & name() const
ScalarColumn< Double > & interval()
ArrayColumn< Double > & pointingOffset()
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
const ScalarColumn< Bool > & onSource() const
MDirection targetMeas(rownr_t row, Double time=0) const
const ScalarQuantColumn< Double > & timeOriginQuant() const
ScalarMeasColumn< MEpoch > & timeMeas()
const ArrayColumn< Double > & sourceOffset() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const ArrayColumn< Double > & target() const
const ScalarMeasColumn< MDirection > & encoderMeas() const
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()
const ArrayMeasColumn< MDirection > & pointingOffsetMeasCol() const
ScalarQuantColumn< Double > timeOriginQuant_p
ScalarMeasColumn< MDirection > & encoderMeas()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch reference type for the TIME &amp; TIME_ORIGIN column.
ScalarColumn< Double > time_p
ArrayColumn< Double > & encoder()
const ScalarColumn< Double > & interval() const
ArrayMeasColumn< MDirection > directionMeas_p
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
ArrayColumn< Double > direction_p
ArrayColumn< Double > pointingOffset_p
ArrayColumn< Double > encoder_p
const ArrayColumn< Double > & encoder() const
ScalarColumn< Bool > overTheTop_p
const ScalarMeasColumn< MEpoch > & timeOriginMeas() const
void attach(const MSPointing &msPointing)
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 ...
const ScalarQuantColumn< Double > & timeQuant() const
ScalarColumn< Bool > & overTheTop()
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarMeasColumn< MDirection > encoderMeas_p
MSPointingColumns & operator=(const MSPointingColumns &)
const ScalarColumn< Bool > & overTheTop() const
ScalarColumn< String > name_p
const Bool True
Definition: aipstype.h:43
const ScalarMeasColumn< MEpoch > & timeMeas() const
ScalarQuantColumn< Double > & timeQuant()
const ScalarColumn< Int > & numPoly() const
const ScalarColumn< Int > & pointingModelId() const