Loading...
Searching...
No Matches
MSAntennaColumns.h
Go to the documentation of this file.
//# MSAntennaColumns.h: provides easy access to MSAntenna columns
//# Copyright (C) 1996,1999,2000
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef MS_MSANTENNACOLUMNS_H
#define MS_MSANTENNACOLUMNS_H
#include <casacore/casa/aips.h>
#include <casacore/measures/Measures/MPosition.h>
#include <casacore/measures/Measures/MCPosition.h>
#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
#include <casacore/tables/Tables/ArrayColumn.h>
#include <casacore/tables/Tables/ScalarColumn.h>
#include <casacore/casa/BasicSL/String.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
class MSAntenna;
// <summary>
// A class to provide easy access to MSAntenna columns
// </summary>
// <use visibility=export>
// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
// </reviewed>
// <prerequisite>
// <li> MSAntenna
// <li> ArrayColumn
// <li> ScalarColumn
// </prerequisite>
//
// <etymology>
// MSAntennaColumns stands for MeasurementSet Antenna Table columns.
// </etymology>
//
// <synopsis>
// This class provides access to the columns in the MSAntenna Table,
// it does the declaration of all the Scalar and ArrayColumns with the
// correct types, so the application programmer doesn't have to
// worry about getting those right. There is an access function
// for every predefined column. Access to non-predefined columns will still
// have to be done with explicit declarations.
// See <linkto class=MSColumns> MSColumns</linkto> for an example.
// </synopsis>
//
// <motivation>
// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
// </motivation>
class MSAntennaColumns
{
public:
// Create a columns object that accesses the data in the specified Table
MSAntennaColumns(const MSAntenna& msAntenna);
// The destructor does nothing special
~MSAntennaColumns();
// Access to required columns
// <group>
ScalarColumn<Double>& dishDiameter() {return dishDiameter_p;}
ScalarQuantColumn<Double>& dishDiameterQuant() {return dishDiameterQuant_p;}
ScalarColumn<Bool>& flagRow() {return flagRow_p;}
ScalarColumn<String>& mount() {return mount_p;}
ScalarColumn<String>& name() {return name_p;}
ArrayColumn<Double>& offset() {return offset_p;}
ArrayQuantColumn<Double>& offsetQuant() {return offsetQuant_p;}
ScalarMeasColumn<MPosition>& offsetMeas() { return offsetMeas_p;}
ArrayColumn<Double>& position() {return position_p;}
ArrayQuantColumn<Double>& positionQuant() {return positionQuant_p;}
ScalarMeasColumn<MPosition>& positionMeas() { return positionMeas_p;}
ScalarColumn<String>& station() {return station_p;}
ScalarColumn<String>& type() {return type_p;}
// </group>
// Const access to required columns
// <group>
const ScalarColumn<Double>& dishDiameter() const {return dishDiameter_p;}
const ScalarQuantColumn<Double>& dishDiameterQuant() const {return dishDiameterQuant_p;}
const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
const ScalarColumn<String>& mount() const {return mount_p;}
const ScalarColumn<String>& name() const {return name_p;}
const ArrayColumn<Double>& offset() const {return offset_p;}
const ArrayQuantColumn<Double>& offsetQuant() const {return offsetQuant_p;}
const ScalarMeasColumn<MPosition>& offsetMeas() const { return offsetMeas_p;}
const ArrayColumn<Double>& position() const {return position_p;}
const ArrayQuantColumn<Double>& positionQuant() const {return positionQuant_p;}
const ScalarMeasColumn<MPosition>& positionMeas() const { return positionMeas_p;}
const ScalarColumn<String>& station() const {return station_p;}
const ScalarColumn<String>& type() const {return type_p;}
// </group>
// Access to optional columns
// <group>
ArrayColumn<Double>& meanOrbit() {return meanOrbit_p;}
ScalarColumn<Int>& orbitId() {return orbitId_p;}
ScalarColumn<Int>& phasedArrayId() {return phasedArrayId_p;}
// </group>
// Const access to optional columns
// <group>
const ArrayColumn<Double>& meanOrbit() const {return meanOrbit_p;}
const ScalarColumn<Int>& orbitId() const {return orbitId_p;}
const ScalarColumn<Int>& phasedArrayId() const {return phasedArrayId_p;}
// </group>
// set the position type for the POSITION column. This can only be done when
// the table has no rows. Trying to do so at other times will throw an
// exception.
void setPositionRef(MPosition::Types ref);
// set the position type for the OFFSET column. This can only be done when
// the table has no rows. Trying to do so at other times will throw an
// exception.
void setOffsetRef(MPosition::Types ref);
// Convenience function that returns the number of rows in any of the columns
rownr_t nrow() const {return dishDiameter_p.nrow();}
// returns the last row that contains an antenna at the specified position,
// to within the specified tolerance. The reference frame of the supplied
// position must be the same as the one for the POSITION columns. If not an
// AipsError is thrown as such an argument will never match any row of the
// Table. The tolerance is the maximum allowed distance between the two
// positions and the supplied Quantum must have dimensions of length. This is
// checked when compiled in debug mode and an AipsError exception is thrown
// if the dimensions are wrong. Returns -1 if no match could be found. Flagged
// rows can never match. If tryRow is non-negative, then that row is tested
// to see if it matches before any others are tested. Setting tryRow to a
// positive value greater than the table length will throw an exception
// (AipsError), when compiled in debug mode.
Int64 matchAntenna(const MPosition& antennaPos,
const Quantum<Double>& tolerance, Int64 tryRow=-1);
// Same as the previous function except that the antenna name must also
// match.
Int64 matchAntenna(const String& antName, const MPosition& antennaPos,
const Quantum<Double>& tolerance, Int64 tryRow=-1);
// Same as the previous function except that the station name must also
// match.
Int64 matchAntennaAndStation(const String& antName,
const String& stationName, // ignored when empty
const MPosition& antennaPos,
const Quantum<Double>& tolerance, Int64 tryRow=-1);
protected:
//# default constructor creates a object that is not usable. Use the attach
//# function correct this.
MSAntennaColumns();
//# attach this object to the supplied table.
void attach(const MSAntenna& msAntenna);
private:
//# Make the assignment operator and the copy constructor private to prevent
//# any compiler generated one from being used.
MSAntennaColumns(const MSAntennaColumns&);
MSAntennaColumns& operator=(const MSAntennaColumns&);
//# Check if any optional columns exist and if so attach them.
void attachOptionalCols(const MSAntenna& msAntenna);
//# Functions which check the supplied values against the relevant column and
//# the specified row.
Bool matchName(rownr_t row, const String& antName) const;
Bool matchStation(rownr_t row, const String& stationName) const;
Bool matchPosition(rownr_t row, const Vector<Double>& antPosInM,
const Double tolInM) const;
//# required columns
ScalarColumn<Double> dishDiameter_p;
ScalarColumn<Bool> flagRow_p;
ScalarColumn<String> mount_p;
ScalarColumn<String> name_p;
ArrayColumn<Double> offset_p;
ArrayColumn<Double> position_p;
ScalarColumn<String> station_p;
ScalarColumn<String> type_p;
//# optional columns
ArrayColumn<Double> meanOrbit_p;
ScalarColumn<Int> orbitId_p;
ScalarColumn<Int> phasedArrayId_p;
//# Access to Measure columns
ScalarMeasColumn<MPosition> offsetMeas_p;
ScalarMeasColumn<MPosition> positionMeas_p;
//# Access to Quantum columns
ScalarQuantColumn<Double> dishDiameterQuant_p;
ArrayQuantColumn<Double> offsetQuant_p;
ArrayQuantColumn<Double> positionQuant_p;
};
//# Define the RO version for backward compatibility.
typedef MSAntennaColumns ROMSAntennaColumns;
} //# NAMESPACE CASACORE - END
#endif
casacore::ArrayColumn
Definition ArrayColumn.h:98
casacore::ArrayQuantColumn
Definition ArrayQuantColumn.h:118
casacore::MPosition
Definition MPosition.h:76
casacore::MPosition::Types
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:91
casacore::MSAntennaColumns
Definition MSAntennaColumns.h:78
casacore::MSAntennaColumns::position_p
ArrayColumn< Double > position_p
Definition MSAntennaColumns.h:205
casacore::MSAntennaColumns::positionQuant_p
ArrayQuantColumn< Double > positionQuant_p
Definition MSAntennaColumns.h:220
casacore::MSAntennaColumns::positionQuant
ArrayQuantColumn< Double > & positionQuant()
Definition MSAntennaColumns.h:98
casacore::MSAntennaColumns::matchStation
Bool matchStation(rownr_t row, const String &stationName) const
casacore::MSAntennaColumns::station_p
ScalarColumn< String > station_p
Definition MSAntennaColumns.h:206
casacore::MSAntennaColumns::matchAntennaAndStation
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.
casacore::MSAntennaColumns::name
const ScalarColumn< String > & name() const
Definition MSAntennaColumns.h:110
casacore::MSAntennaColumns::offset
const ArrayColumn< Double > & offset() const
Definition MSAntennaColumns.h:111
casacore::MSAntennaColumns::matchAntenna
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.
casacore::MSAntennaColumns::orbitId
const ScalarColumn< Int > & orbitId() const
Definition MSAntennaColumns.h:131
casacore::MSAntennaColumns::dishDiameterQuant
const ScalarQuantColumn< Double > & dishDiameterQuant() const
Definition MSAntennaColumns.h:107
casacore::MSAntennaColumns::operator=
MSAntennaColumns & operator=(const MSAntennaColumns &)
casacore::MSAntennaColumns::offsetQuant
ArrayQuantColumn< Double > & offsetQuant()
Definition MSAntennaColumns.h:95
casacore::MSAntennaColumns::name_p
ScalarColumn< String > name_p
Definition MSAntennaColumns.h:203
casacore::MSAntennaColumns::attachOptionalCols
void attachOptionalCols(const MSAntenna &msAntenna)
casacore::MSAntennaColumns::positionMeas_p
ScalarMeasColumn< MPosition > positionMeas_p
Definition MSAntennaColumns.h:215
casacore::MSAntennaColumns::offsetQuant_p
ArrayQuantColumn< Double > offsetQuant_p
Definition MSAntennaColumns.h:219
casacore::MSAntennaColumns::position
const ArrayColumn< Double > & position() const
Definition MSAntennaColumns.h:114
casacore::MSAntennaColumns::phasedArrayId
ScalarColumn< Int > & phasedArrayId()
Definition MSAntennaColumns.h:125
casacore::MSAntennaColumns::station
const ScalarColumn< String > & station() const
Definition MSAntennaColumns.h:117
casacore::MSAntennaColumns::station
ScalarColumn< String > & station()
Definition MSAntennaColumns.h:100
casacore::MSAntennaColumns::positionMeas
const ScalarMeasColumn< MPosition > & positionMeas() const
Definition MSAntennaColumns.h:116
casacore::MSAntennaColumns::offsetQuant
const ArrayQuantColumn< Double > & offsetQuant() const
Definition MSAntennaColumns.h:112
casacore::MSAntennaColumns::offsetMeas_p
ScalarMeasColumn< MPosition > offsetMeas_p
Definition MSAntennaColumns.h:214
casacore::MSAntennaColumns::matchAntenna
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...
casacore::MSAntennaColumns::phasedArrayId_p
ScalarColumn< Int > phasedArrayId_p
Definition MSAntennaColumns.h:211
casacore::MSAntennaColumns::flagRow_p
ScalarColumn< Bool > flagRow_p
Definition MSAntennaColumns.h:201
casacore::MSAntennaColumns::type
ScalarColumn< String > & type()
Definition MSAntennaColumns.h:101
casacore::MSAntennaColumns::meanOrbit_p
ArrayColumn< Double > meanOrbit_p
Definition MSAntennaColumns.h:209
casacore::MSAntennaColumns::matchName
Bool matchName(rownr_t row, const String &antName) const
casacore::MSAntennaColumns::meanOrbit
ArrayColumn< Double > & meanOrbit()
Access to optional columns.
Definition MSAntennaColumns.h:123
casacore::MSAntennaColumns::dishDiameterQuant_p
ScalarQuantColumn< Double > dishDiameterQuant_p
Definition MSAntennaColumns.h:218
casacore::MSAntennaColumns::phasedArrayId
const ScalarColumn< Int > & phasedArrayId() const
Definition MSAntennaColumns.h:132
casacore::MSAntennaColumns::type_p
ScalarColumn< String > type_p
Definition MSAntennaColumns.h:207
casacore::MSAntennaColumns::name
ScalarColumn< String > & name()
Definition MSAntennaColumns.h:93
casacore::MSAntennaColumns::offsetMeas
const ScalarMeasColumn< MPosition > & offsetMeas() const
Definition MSAntennaColumns.h:113
casacore::MSAntennaColumns::flagRow
const ScalarColumn< Bool > & flagRow() const
Definition MSAntennaColumns.h:108
casacore::MSAntennaColumns::dishDiameter_p
ScalarColumn< Double > dishDiameter_p
Definition MSAntennaColumns.h:200
casacore::MSAntennaColumns::setPositionRef
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
casacore::MSAntennaColumns::dishDiameter
const ScalarColumn< Double > & dishDiameter() const
Const access to required columns.
Definition MSAntennaColumns.h:106
casacore::MSAntennaColumns::type
const ScalarColumn< String > & type() const
Definition MSAntennaColumns.h:118
casacore::MSAntennaColumns::mount_p
ScalarColumn< String > mount_p
Definition MSAntennaColumns.h:202
casacore::MSAntennaColumns::offset
ArrayColumn< Double > & offset()
Definition MSAntennaColumns.h:94
casacore::MSAntennaColumns::orbitId_p
ScalarColumn< Int > orbitId_p
Definition MSAntennaColumns.h:210
casacore::MSAntennaColumns::mount
const ScalarColumn< String > & mount() const
Definition MSAntennaColumns.h:109
casacore::MSAntennaColumns::~MSAntennaColumns
~MSAntennaColumns()
The destructor does nothing special.
casacore::MSAntennaColumns::positionQuant
const ArrayQuantColumn< Double > & positionQuant() const
Definition MSAntennaColumns.h:115
casacore::MSAntennaColumns::dishDiameterQuant
ScalarQuantColumn< Double > & dishDiameterQuant()
Definition MSAntennaColumns.h:90
casacore::MSAntennaColumns::position
ArrayColumn< Double > & position()
Definition MSAntennaColumns.h:97
casacore::MSAntennaColumns::orbitId
ScalarColumn< Int > & orbitId()
Definition MSAntennaColumns.h:124
casacore::MSAntennaColumns::dishDiameter
ScalarColumn< Double > & dishDiameter()
Access to required columns.
Definition MSAntennaColumns.h:89
casacore::MSAntennaColumns::positionMeas
ScalarMeasColumn< MPosition > & positionMeas()
Definition MSAntennaColumns.h:99
casacore::MSAntennaColumns::meanOrbit
const ArrayColumn< Double > & meanOrbit() const
Const access to optional columns.
Definition MSAntennaColumns.h:130
casacore::MSAntennaColumns::MSAntennaColumns
MSAntennaColumns()
casacore::MSAntennaColumns::offset_p
ArrayColumn< Double > offset_p
Definition MSAntennaColumns.h:204
casacore::MSAntennaColumns::MSAntennaColumns
MSAntennaColumns(const MSAntenna &msAntenna)
Create a columns object that accesses the data in the specified Table.
casacore::MSAntennaColumns::nrow
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition MSAntennaColumns.h:146
casacore::MSAntennaColumns::MSAntennaColumns
MSAntennaColumns(const MSAntennaColumns &)
casacore::MSAntennaColumns::setOffsetRef
void setOffsetRef(MPosition::Types ref)
set the position type for the OFFSET column.
casacore::MSAntennaColumns::offsetMeas
ScalarMeasColumn< MPosition > & offsetMeas()
Definition MSAntennaColumns.h:96
casacore::MSAntennaColumns::mount
ScalarColumn< String > & mount()
Definition MSAntennaColumns.h:92
casacore::MSAntennaColumns::attach
void attach(const MSAntenna &msAntenna)
casacore::MSAntennaColumns::flagRow
ScalarColumn< Bool > & flagRow()
Definition MSAntennaColumns.h:91
casacore::MSAntennaColumns::matchPosition
Bool matchPosition(rownr_t row, const Vector< Double > &antPosInM, const Double tolInM) const
casacore::MSAntenna
Definition MSAntenna.h:78
casacore::Quantum
Definition Quantum.h:269
casacore::ScalarColumn
Definition ScalarColumn.h:83
casacore::ScalarMeasColumn
Definition ScalarMeasColumn.h:141
casacore::ScalarQuantColumn
Definition ScalarQuantColumn.h:118
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::Vector
Definition Vector.h:82
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::ref
const RecordRep & ref() const
Return a const reference to the underlying RecordRep.
casacore::Int64
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
casacore::ROMSAntennaColumns
MSAntennaColumns ROMSAntennaColumns
Definition MSAntennaColumns.h:225
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::Double
double Double
Definition aipstype.h:53
casacore::rownr_t
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44