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
44// <summary>
45// A class to provide easy access to MSAntenna columns
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
51// </reviewed>
52
53// <prerequisite>
54// <li> MSAntenna
55// <li> ArrayColumn
56// <li> ScalarColumn
57// </prerequisite>
58//
59// <etymology>
60// MSAntennaColumns stands for MeasurementSet Antenna Table columns.
61// </etymology>
62//
63// <synopsis>
64// This class provides access to the columns in the MSAntenna Table,
65// it does the declaration of all the Scalar and ArrayColumns with the
66// correct types, so the application programmer doesn't have to
67// worry about getting those right. There is an access function
68// for every predefined column. Access to non-predefined columns will still
69// have to be done with explicit declarations.
70// See <linkto class=MSColumns> MSColumns</linkto> for an example.
71// </synopsis>
72//
73// <motivation>
74// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
75// </motivation>
76
78{
79public:
80
81 // Create a columns object that accesses the data in the specified Table
82 MSAntennaColumns(const MSAntenna& msAntenna);
83
84 // The destructor does nothing special
86
87 // Access to required columns
88 // <group>
102 // </group>
103
104 // Const access to required columns
105 // <group>
108 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
109 const ScalarColumn<String>& mount() const {return mount_p;}
110 const ScalarColumn<String>& name() const {return name_p;}
111 const ArrayColumn<Double>& offset() const {return offset_p;}
114 const ArrayColumn<Double>& position() const {return position_p;}
117 const ScalarColumn<String>& station() const {return station_p;}
118 const ScalarColumn<String>& type() const {return type_p;}
119 // </group>
120
121 // Access to optional columns
122 // <group>
126 // </group>
127
128 // Const access to optional columns
129 // <group>
131 const ScalarColumn<Int>& orbitId() const {return orbitId_p;}
133 // </group>
134
135 // set the position type for the POSITION column. This can only be done when
136 // the table has no rows. Trying to do so at other times will throw an
137 // exception.
139
140 // set the position type for the OFFSET column. This can only be done when
141 // the table has no rows. Trying to do so at other times will throw an
142 // exception.
144
145 // Convenience function that returns the number of rows in any of the columns
146 rownr_t nrow() const {return dishDiameter_p.nrow();}
147
148 // returns the last row that contains an antenna at the specified position,
149 // to within the specified tolerance. The reference frame of the supplied
150 // position must be the same as the one for the POSITION columns. If not an
151 // AipsError is thrown as such an argument will never match any row of the
152 // Table. The tolerance is the maximum allowed distance between the two
153 // positions and the supplied Quantum must have dimensions of length. This is
154 // checked when compiled in debug mode and an AipsError exception is thrown
155 // if the dimensions are wrong. Returns -1 if no match could be found. Flagged
156 // rows can never match. If tryRow is non-negative, then that row is tested
157 // to see if it matches before any others are tested. Setting tryRow to a
158 // positive value greater than the table length will throw an exception
159 // (AipsError), when compiled in debug mode.
160 Int64 matchAntenna(const MPosition& antennaPos,
161 const Quantum<Double>& tolerance, Int64 tryRow=-1);
162
163 // Same as the previous function except that the antenna name must also
164 // match.
165 Int64 matchAntenna(const String& antName, const MPosition& antennaPos,
166 const Quantum<Double>& tolerance, Int64 tryRow=-1);
167
168 // Same as the previous function except that the station name must also
169 // match.
171 const String& stationName, // ignored when empty
172 const MPosition& antennaPos,
173 const Quantum<Double>& tolerance, Int64 tryRow=-1);
174
175protected:
176 //# default constructor creates a object that is not usable. Use the attach
177 //# function correct this.
179
180 //# attach this object to the supplied table.
181 void attach(const MSAntenna& msAntenna);
182
183private:
184 //# Make the assignment operator and the copy constructor private to prevent
185 //# any compiler generated one from being used.
188
189 //# Check if any optional columns exist and if so attach them.
190 void attachOptionalCols(const MSAntenna& msAntenna);
191
192 //# Functions which check the supplied values against the relevant column and
193 //# the specified row.
194 Bool matchName(rownr_t row, const String& antName) const;
195 Bool matchStation(rownr_t row, const String& stationName) const;
196 Bool matchPosition(rownr_t row, const Vector<Double>& antPosInM,
197 const Double tolInM) const;
198
199 //# required columns
208 //# optional columns
212
213 //# Access to Measure columns
216
217 //# Access to Quantum columns
221
222};
223
224//# Define the RO version for backward compatibility.
226
227} //# NAMESPACE CASACORE - END
228
229#endif
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:91
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:223
rownr_t nrow() const
Get the number of rows in the column.
this file contains all the compiler specific defines
Definition mainpage.dox:28
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