casacore
MSFeedColumns.h
Go to the documentation of this file.
1 //# MSFeedColumns.h: provides easy access to MSFeed 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_MSFEEDCOLUMNS_H
29 #define MS_MSFEEDCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/casa/BasicSL/Complex.h>
33 #include <casacore/measures/Measures/MDirection.h>
34 #include <casacore/measures/Measures/MEpoch.h>
35 #include <casacore/measures/Measures/MPosition.h>
36 #include <casacore/measures/Measures/MCDirection.h>
37 #include <casacore/measures/Measures/MCEpoch.h>
38 #include <casacore/measures/Measures/MCPosition.h>
39 #include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
40 #include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
41 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
42 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
43 #include <casacore/tables/Tables/ArrayColumn.h>
44 #include <casacore/tables/Tables/ScalarColumn.h>
45 #include <casacore/casa/BasicSL/String.h>
46 
47 namespace casacore { //# NAMESPACE CASACORE - BEGIN
48 
49 class MSFeed;
50 
51 // <summary>
52 // A class to provide easy access to MSFeed columns
53 // </summary>
54 
55 // <use visibility=export>
56 
57 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
58 // </reviewed>
59 
60 // <prerequisite>
61 // <li> MSFeed
62 // <li> ArrayColumn
63 // <li> ScalarColumn
64 // </prerequisite>
65 //
66 // <etymology>
67 // MSFeedColumns stands for MeasurementSet Feed Table columns.
68 // </etymology>
69 //
70 // <synopsis>
71 // This class provides access to the columns in the MSFeed Table,
72 // it does the declaration of all the Scalar and ArrayColumns with the
73 // correct types, so the application programmer doesn't have to
74 // worry about getting those right. There is an access function
75 // for every predefined column. Access to non-predefined columns will still
76 // have to be done with explicit declarations.
77 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
78 // </synopsis>
79 //
80 // <motivation>
81 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
82 // </motivation>
83 
85 {
86 public:
87  // Create a columns object that accesses the data in the specified Table
88  MSFeedColumns(const MSFeed& msFeed);
89 
90  // The desctructor does nothing special
92 
93  // Access to required columns
94  // <group>
100  {return beamOffsetMeas_p;}
110  { return positionMeas_p;}
113  return receptorAngleQuant_p;}
118  // </group>
119 
120  // Const access to required columns
121  // <group>
122  const ScalarColumn<Int>& antennaId() const {return antennaId_p;}
123  const ScalarColumn<Int>& beamId() const {return beamId_p;}
124  const ArrayColumn<Double>& beamOffset() const {return beamOffset_p;}
127  {return beamOffsetMeas_p;}
128  const ScalarColumn<Int>& feedId() const {return feedId_p;}
129  const ScalarColumn<Double>& interval() const {return interval_p;}
134  const ArrayColumn<Double>& position() const {return position_p;}
137  { return positionMeas_p;}
140  return receptorAngleQuant_p;}
142  const ScalarColumn<Double>& time() const {return time_p;}
144  const ScalarMeasColumn<MEpoch>& timeMeas() const { return timeMeas_p;}
145  // </group>
146 
147  // Access to optional columns
148  // <group>
152  // </group>
153 
154  // Const access to optional columns
155  // <group>
159  // </group>
160 
161  // set the epoch type for the TIME column.
162  // <note role=tip>
163  // In principle this function can only be used if the table is empty,
164  // otherwise already written values may thereafter have an incorrect
165  // reference, offset, or unit. However, it is possible that part of the
166  // table gets written before these values are known. In that case the
167  // reference, offset, or units can be set by using a False
168  // <src>tableMustBeEmpty</src> argument.
169  // </note>
170  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
171 
172  // set the direction type for the BEAM_OFFSET column. This can only be done
173  // when the table has no rows. Trying to do so at other times will throw an
174  // exception.
176 
177  // set the position type for the POSITION column. This can only be done when
178  // the table has no rows. Trying to do so at other times will throw an
179  // exception.
181 
182  // Convenience function that returns the number of rows in any of the columns
183  rownr_t nrow() const {return antennaId_p.nrow();}
184 
185  // Returns the last row that contains a feed with the specified values.
186  // If no matching row can be found, but a match is possible if the validity
187  // time interval is widened, return that row and the suggestion for the
188  // new time information.
189  // If no change to time is necessary, newTimeQ and newIntervalQ are zero.
190  // Returns -1 if no match could be found.
191  // Ignore the Feed table rows contained in vector ignoreRows.
192  // focusLengthQ is only compared if this optional column is present and
193  // if the value of focusLengthQ is not dimensionless.
195  Quantum<Double>& newIntervalQ,
196  Int antId,
197  Int feedId,
198  Int spwId,
199  const Quantum<Double>& timeQ,
200  const Quantum<Double>& intervalQ,
201  Int numReceptor,
202  const Array<Quantum<Double> >& beamOffsetQ,
203  const Array<String>& polType,
204  const Array<Complex>& polResp,
205  const Array<Quantum<Double> >& positionQ,
206  const Array<Quantum<Double> >& receptorAngleQ,
207  const RowNumbers& ignoreRows,
208  const Quantum<Double>& focusLengthQ=Quantum<Double>()
209  );
210 
211 protected:
212  //# default constructor creates a object that is not usable. Use the attach
213  //# function correct this.
215 
216  //# attach this object to the supplied table.
217  void attach(const MSFeed& msFeed);
218 
219 private:
220  //# Make the assignment operator and the copy constructor private to prevent
221  //# any compiler generated one from being used.
224 
225  //# Check if any optional columns exist and if so attach them.
226  void attachOptionalCols(const MSFeed& msFeed);
227 
228  //# required columns
241  //# optional columns
244 
245  //# Access to Measure columns
249 
250  //# Access to Quantum columns
256  //# optional Quantum columns
258 };
259 
260 //# Define the RO version for backward compatibility.
262 
263 } //# NAMESPACE CASACORE - END
264 
265 #endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
ScalarColumn< Double > focusLength_p
MSFeedColumns(const MSFeedColumns &)
MSFeedColumns(const MSFeed &msFeed)
Create a columns object that accesses the data in the specified Table.
ArrayMeasColumn< MDirection > beamOffsetMeas_p
ScalarColumn< Double > & focusLength()
Access to optional columns.
ArrayColumn< Double > beamOffset_p
const ArrayColumn< String > & polarizationType() const
const ArrayQuantColumn< Double > & beamOffsetQuant() const
ScalarColumn< Int > & beamId()
Definition: MSFeedColumns.h:96
ArrayQuantColumn< Double > & beamOffsetQuant()
Definition: MSFeedColumns.h:98
ArrayColumn< Double > & beamOffset()
Definition: MSFeedColumns.h:97
const ArrayQuantColumn< Double > & receptorAngleQuant() const
ScalarQuantColumn< Double > focusLengthQuant_p
ArrayQuantColumn< Double > & receptorAngleQuant()
ScalarMeasColumn< MEpoch > & timeMeas()
ArrayColumn< Double > & position()
ScalarMeasColumn< MEpoch > timeMeas_p
ScalarQuantColumn< Double > timeQuant_p
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
void attach(const MSFeed &msFeed)
ScalarColumn< Int > & feedId()
ScalarColumn< Int > beamId_p
const ScalarMeasColumn< MEpoch > & timeMeas() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
const ArrayColumn< Double > & position() const
const ArrayColumn< Double > & receptorAngle() const
ArrayColumn< String > & polarizationType()
const ArrayQuantColumn< Double > & positionQuant() const
ScalarQuantColumn< Double > intervalQuant_p
ArrayColumn< Double > & receptorAngle()
const ScalarColumn< Double > & interval() const
ArrayColumn< Double > position_p
ArrayQuantColumn< Double > positionQuant_p
MSFeedColumns & operator=(const MSFeedColumns &)
ScalarMeasColumn< MPosition > positionMeas_p
void attachOptionalCols(const MSFeed &msFeed)
ScalarColumn< Int > & phasedFeedId()
ScalarColumn< Int > spectralWindowId_p
const ArrayMeasColumn< MDirection > & beamOffsetMeas() const
ScalarColumn< Double > & time()
const ScalarQuantColumn< Double > & focusLengthQuant() const
const ScalarMeasColumn< MPosition > & positionMeas() const
const ArrayColumn< Double > & beamOffset() const
const ArrayColumn< Complex > & polResponse() const
ArrayColumn< Complex > & polResponse()
ArrayQuantColumn< Double > beamOffsetQuant_p
const ScalarColumn< Int > & beamId() const
const ScalarQuantColumn< Double > & intervalQuant() const
ArrayColumn< String > polarizationType_p
ScalarColumn< Int > antennaId_p
const ScalarColumn< Double > & time() const
ScalarColumn< Double > & interval()
Int64 matchFeed(Quantum< Double > &newTimeQ, Quantum< Double > &newIntervalQ, Int antId, Int feedId, Int spwId, const Quantum< Double > &timeQ, const Quantum< Double > &intervalQ, Int numReceptor, const Array< Quantum< Double > > &beamOffsetQ, const Array< String > &polType, const Array< Complex > &polResp, const Array< Quantum< Double > > &positionQ, const Array< Quantum< Double > > &receptorAngleQ, const RowNumbers &ignoreRows, const Quantum< Double > &focusLengthQ=Quantum< Double >())
Returns the last row that contains a feed with the specified values.
const ScalarColumn< Int > & feedId() const
ArrayQuantColumn< Double > receptorAngleQuant_p
ScalarColumn< Double > time_p
const ScalarColumn< Int > & spectralWindowId() const
ArrayQuantColumn< Double > & positionQuant()
~MSFeedColumns()
The desctructor does nothing special.
ScalarQuantColumn< Double > & intervalQuant()
ScalarColumn< Int > numReceptors_p
ArrayMeasColumn< MDirection > & beamOffsetMeas()
Definition: MSFeedColumns.h:99
ArrayColumn< Double > receptorAngle_p
ScalarQuantColumn< Double > & focusLengthQuant()
const ScalarColumn< Int > & numReceptors() const
ScalarColumn< Int > & numReceptors()
ArrayColumn< Complex > polResponse_p
ScalarColumn< Int > phasedFeedId_p
const ScalarColumn< Double > & focusLength() const
Const access to optional columns.
ScalarMeasColumn< MPosition > & positionMeas()
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
const ScalarColumn< Int > & antennaId() const
Const access to required columns.
const ScalarQuantColumn< Double > & timeQuant() const
ScalarColumn< Int > feedId_p
ScalarColumn< Int > & antennaId()
Access to required columns.
Definition: MSFeedColumns.h:95
ScalarColumn< Double > interval_p
void setDirectionRef(MDirection::Types ref)
set the direction type for the BEAM_OFFSET column.
ScalarQuantColumn< Double > & timeQuant()
ScalarColumn< Int > & spectralWindowId()
const ScalarColumn< Int > & phasedFeedId() const
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
this file contains all the compiler specific defines
Definition: mainpage.dox:28
MSFeedColumns ROMSFeedColumns
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
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46