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: 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_MSANTENNACOLUMNS_H
29#define MS_MSANTENNACOLUMNS_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/measures/Measures/MPosition.h>
33#include <casacore/measures/Measures/MCPosition.h>
34#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
35#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
36#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
37#include <casacore/tables/Tables/ArrayColumn.h>
38#include <casacore/tables/Tables/ScalarColumn.h>
39#include <casacore/casa/BasicSL/String.h>
40
41namespace casacore { //# NAMESPACE CASACORE - BEGIN
42
43class MSAntenna;
44
45
46// <summary>
47// A class to provide easy access to MSAntenna 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> MSAntenna
57// <li> ArrayColumn
58// <li> ScalarColumn
59// </prerequisite>
60//
61// <etymology>
62// MSAntennaColumns stands for MeasurementSet Antenna Table columns.
63// </etymology>
64//
65// <synopsis>
66// This class provides access to the columns in the MSAntenna 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{
81public:
82
83 // Create a columns object that accesses the data in the specified Table
84 MSAntennaColumns(const MSAntenna& msAntenna);
85
86 // The destructor does nothing special
88
89 // Access to required columns
90 // <group>
104 // </group>
105
106 // Const access to required columns
107 // <group>
110 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
111 const ScalarColumn<String>& mount() const {return mount_p;}
112 const ScalarColumn<String>& name() const {return name_p;}
113 const ArrayColumn<Double>& offset() const {return offset_p;}
116 const ArrayColumn<Double>& position() const {return position_p;}
119 const ScalarColumn<String>& station() const {return station_p;}
120 const ScalarColumn<String>& type() const {return type_p;}
121 // </group>
122
123 // Access to optional columns
124 // <group>
128 // </group>
129
130 // Const access to optional columns
131 // <group>
133 const ScalarColumn<Int>& orbitId() const {return orbitId_p;}
135 // </group>
136
137 // set the position type for the POSITION 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 // set the position type for the OFFSET column. This can only be done when
143 // the table has no rows. Trying to do so at other times will throw an
144 // exception.
146
147 // Convenience function that returns the number of rows in any of the columns
148 rownr_t nrow() const {return dishDiameter_p.nrow();}
149
150 // returns the last row that contains an antenna at the specified position,
151 // to within the specified tolerance. The reference frame of the supplied
152 // position must be the same as the one for the POSITION columns. If not an
153 // AipsError is thrown as such an argument will never match any row of the
154 // Table. The tolerance is the maximum allowed distance between the two
155 // positions and the supplied Quantum must have dimensions of length. This is
156 // checked when compiled in debug mode and an AipsError exception is thrown
157 // if the dimensions are wrong. Returns -1 if no match could be found. Flagged
158 // rows can never match. If tryRow is non-negative, then that row is tested
159 // to see if it matches before any others are tested. Setting tryRow to a
160 // positive value greater than the table length will throw an exception
161 // (AipsError), when compiled in debug mode.
162 Int64 matchAntenna(const MPosition& antennaPos,
163 const Quantum<Double>& tolerance, Int64 tryRow=-1);
164
165 // Same as the previous function except that the antenna name must also
166 // match.
167 Int64 matchAntenna(const String& antName, const MPosition& antennaPos,
168 const Quantum<Double>& tolerance, Int64 tryRow=-1);
169
170 // Same as the previous function except that the station name must also
171 // match.
173 const String& stationName, // ignored when empty
174 const MPosition& antennaPos,
175 const Quantum<Double>& tolerance, Int64 tryRow=-1);
176
177protected:
178 //# default constructor creates a object that is not usable. Use the attach
179 //# function correct this.
181
182 //# attach this object to the supplied table.
183 void attach(const MSAntenna& msAntenna);
184
185private:
186 //# Make the assignment operator and the copy constructor private to prevent
187 //# any compiler generated one from being used.
190
191 //# Check if any optional columns exist and if so attach them.
192 void attachOptionalCols(const MSAntenna& msAntenna);
193
194 //# Functions which check the supplied values against the relevant column and
195 //# the specified row.
196 Bool matchName(rownr_t row, const String& antName) const;
197 Bool matchStation(rownr_t row, const String& stationName) const;
198 Bool matchPosition(rownr_t row, const Vector<Double>& antPosInM,
199 const Double tolInM) const;
200
201 //# required columns
210 //# optional columns
214
215 //# Access to Measure columns
218
219 //# Access to Quantum columns
223
224};
225
226//# Define the RO version for backward compatibility.
228
229} //# NAMESPACE CASACORE - END
230
231#endif
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:94
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:225
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:38
MSAntennaColumns ROMSAntennaColumns
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:42
double Double
Definition aipstype.h:55
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:46