casacore
Loading...
Searching...
No Matches
MSAntennaColumns.h
Go to the documentation of this file.
1// # MSAntennaColumns.h: provides easy access to MSAntenna columns
2// # Copyright (C) 1996,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: casa-feedback@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#ifndef MS_MSANTENNACOLUMNS_H
27#define MS_MSANTENNACOLUMNS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/measures/Measures/MPosition.h>
31#include <casacore/measures/Measures/MCPosition.h>
32#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
33#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
34#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
35#include <casacore/tables/Tables/ArrayColumn.h>
36#include <casacore/tables/Tables/ScalarColumn.h>
37#include <casacore/casa/BasicSL/String.h>
38
39namespace casacore { // # NAMESPACE CASACORE - BEGIN
40
41class MSAntenna;
42
43// <summary>
44// A class to provide easy access to MSAntenna columns
45// </summary>
46
47// <use visibility=export>
48
49// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
50// </reviewed>
51
52// <prerequisite>
53// <li> MSAntenna
54// <li> ArrayColumn
55// <li> ScalarColumn
56// </prerequisite>
57//
58// <etymology>
59// MSAntennaColumns stands for MeasurementSet Antenna Table columns.
60// </etymology>
61//
62// <synopsis>
63// This class provides access to the columns in the MSAntenna Table,
64// it does the declaration of all the Scalar and ArrayColumns with the
65// correct types, so the application programmer doesn't have to
66// worry about getting those right. There is an access function
67// for every predefined column. Access to non-predefined columns will still
68// have to be done with explicit declarations.
69// See <linkto class=MSColumns> MSColumns</linkto> for an example.
70// </synopsis>
71//
72// <motivation>
73// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
74// </motivation>
75
77 public:
78 // Create a columns object that accesses the data in the specified Table
79 MSAntennaColumns(const MSAntenna& msAntenna);
80
81 // The destructor does nothing special
83
84 // Access to required columns
85 // <group>
99 // </group>
100
101 // Const access to required columns
102 // <group>
105 const ScalarColumn<Bool>& flagRow() const { return flagRow_p; }
106 const ScalarColumn<String>& mount() const { return mount_p; }
107 const ScalarColumn<String>& name() const { return name_p; }
108 const ArrayColumn<Double>& offset() const { return offset_p; }
111 const ArrayColumn<Double>& position() const { return position_p; }
114 const ScalarColumn<String>& station() const { return station_p; }
115 const ScalarColumn<String>& type() const { return type_p; }
116 // </group>
117
118 // Access to optional columns
119 // <group>
123 // </group>
124
125 // Const access to optional columns
126 // <group>
127 const ArrayColumn<Double>& meanOrbit() const { return meanOrbit_p; }
128 const ScalarColumn<Int>& orbitId() const { return orbitId_p; }
130 // </group>
131
132 // set the position type for the POSITION column. This can only be done when
133 // the table has no rows. Trying to do so at other times will throw an
134 // exception.
136
137 // set the position type for the OFFSET column. This can only be done when
138 // the table has no rows. Trying to do so at other times will throw an
139 // exception.
141
142 // Convenience function that returns the number of rows in any of the columns
143 rownr_t nrow() const { return dishDiameter_p.nrow(); }
144
145 // returns the last row that contains an antenna at the specified position,
146 // to within the specified tolerance. The reference frame of the supplied
147 // position must be the same as the one for the POSITION columns. If not an
148 // AipsError is thrown as such an argument will never match any row of the
149 // Table. The tolerance is the maximum allowed distance between the two
150 // positions and the supplied Quantum must have dimensions of length. This is
151 // checked when compiled in debug mode and an AipsError exception is thrown
152 // if the dimensions are wrong. Returns -1 if no match could be found. Flagged
153 // rows can never match. If tryRow is non-negative, then that row is tested
154 // to see if it matches before any others are tested. Setting tryRow to a
155 // positive value greater than the table length will throw an exception
156 // (AipsError), when compiled in debug mode.
157 Int64 matchAntenna(const MPosition& antennaPos, const Quantum<Double>& tolerance,
158 Int64 tryRow = -1);
159
160 // Same as the previous function except that the antenna name must also
161 // match.
162 Int64 matchAntenna(const String& antName, const MPosition& antennaPos,
163 const Quantum<Double>& tolerance, Int64 tryRow = -1);
164
165 // Same as the previous function except that the station name must also
166 // match.
168 const String& stationName, // ignored when empty
169 const MPosition& antennaPos, const Quantum<Double>& tolerance,
170 Int64 tryRow = -1);
171
172 protected:
173 // # default constructor creates a object that is not usable. Use the attach
174 // # function correct this.
176
177 // # attach this object to the supplied table.
178 void attach(const MSAntenna& msAntenna);
179
180 private:
181 // # Make the assignment operator and the copy constructor private to prevent
182 // # any compiler generated one from being used.
185
186 // # Check if any optional columns exist and if so attach them.
187 void attachOptionalCols(const MSAntenna& msAntenna);
188
189 // # Functions which check the supplied values against the relevant column and
190 // # the specified row.
191 Bool matchName(rownr_t row, const String& antName) const;
192 Bool matchStation(rownr_t row, const String& stationName) const;
193 Bool matchPosition(rownr_t row, const Vector<Double>& antPosInM, const Double tolInM) const;
194
195 // # required columns
204 // # optional columns
208
209 // # Access to Measure columns
212
213 // # Access to Quantum columns
217};
218
219// # Define the RO version for backward compatibility.
221
222} // namespace casacore
223
224#endif
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:93
ArrayColumn< Double > position_p
ArrayQuantColumn< Double > positionQuant_p
ArrayQuantColumn< Double > & positionQuant()
Bool matchStation(rownr_t row, const String &stationName) const
ScalarColumn< String > station_p
Int64 matchAntennaAndStation(const String &antName, const String &stationName, const MPosition &antennaPos, const Quantum< Double > &tolerance, Int64 tryRow=-1)
Same as the previous function except that the station name must also match.
const ScalarColumn< String > & name() const
const ArrayColumn< Double > & offset() const
Int64 matchAntenna(const String &antName, const MPosition &antennaPos, const Quantum< Double > &tolerance, Int64 tryRow=-1)
Same as the previous function except that the antenna name must also match.
const ScalarColumn< Int > & orbitId() const
const ScalarQuantColumn< Double > & dishDiameterQuant() const
MSAntennaColumns & operator=(const MSAntennaColumns &)
ArrayQuantColumn< Double > & offsetQuant()
ScalarColumn< String > name_p
void attachOptionalCols(const MSAntenna &msAntenna)
ScalarMeasColumn< MPosition > positionMeas_p
ArrayQuantColumn< Double > offsetQuant_p
const ArrayColumn< Double > & position() const
ScalarColumn< Int > & phasedArrayId()
const ScalarColumn< String > & station() const
ScalarColumn< String > & station()
const ScalarMeasColumn< MPosition > & positionMeas() const
const ArrayQuantColumn< Double > & offsetQuant() const
ScalarMeasColumn< MPosition > offsetMeas_p
Int64 matchAntenna(const MPosition &antennaPos, const Quantum< Double > &tolerance, Int64 tryRow=-1)
returns the last row that contains an antenna at the specified position, to within the specified tole...
ScalarColumn< Int > phasedArrayId_p
ScalarColumn< Bool > flagRow_p
ScalarColumn< String > & type()
ArrayColumn< Double > meanOrbit_p
Bool matchName(rownr_t row, const String &antName) const
ArrayColumn< Double > & meanOrbit()
Access to optional columns.
ScalarQuantColumn< Double > dishDiameterQuant_p
const ScalarColumn< Int > & phasedArrayId() const
ScalarColumn< String > type_p
ScalarColumn< String > & name()
const ScalarMeasColumn< MPosition > & offsetMeas() const
const ScalarColumn< Bool > & flagRow() const
ScalarColumn< Double > dishDiameter_p
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
const ScalarColumn< Double > & dishDiameter() const
Const access to required columns.
const ScalarColumn< String > & type() const
ScalarColumn< String > mount_p
ArrayColumn< Double > & offset()
ScalarColumn< Int > orbitId_p
const ScalarColumn< String > & mount() const
~MSAntennaColumns()
The destructor does nothing special.
const ArrayQuantColumn< Double > & positionQuant() const
ScalarQuantColumn< Double > & dishDiameterQuant()
ArrayColumn< Double > & position()
ScalarColumn< Int > & orbitId()
ScalarColumn< Double > & dishDiameter()
Access to required columns.
ScalarMeasColumn< MPosition > & positionMeas()
const ArrayColumn< Double > & meanOrbit() const
Const access to optional columns.
ArrayColumn< Double > offset_p
MSAntennaColumns(const MSAntenna &msAntenna)
Create a columns object that accesses the data in the specified Table.
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
MSAntennaColumns(const MSAntennaColumns &)
void setOffsetRef(MPosition::Types ref)
set the position type for the OFFSET column.
ScalarMeasColumn< MPosition > & offsetMeas()
ScalarColumn< String > & mount()
void attach(const MSAntenna &msAntenna)
ScalarColumn< Bool > & flagRow()
Bool matchPosition(rownr_t row, const Vector< Double > &antPosInM, const Double tolInM) const
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const RecordRep & ref() const
Return a const reference to the underlying RecordRep.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
MSAntennaColumns ROMSAntennaColumns
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44