casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
46 
47 namespace casacore { //# NAMESPACE CASACORE - BEGIN
48 
49 class MSFeed;
50 
51 // <summary>
52 // A class to provide easy read-only 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 // ROMSFeedColumns stands for Read-Only MeasurementSet Feed Table columns.
68 // </etymology>
69 //
70 // <synopsis>
71 // This class provides read-only 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=ROMSColumns> ROMSColumns</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  ROMSFeedColumns(const MSFeed& msFeed);
89 
90  // The destructor does nothing special
92 
93  // Access to required columns
94  // <group>
95  const ROScalarColumn<Int>& antennaId() const {return antennaId_p;}
96  const ROScalarColumn<Int>& beamId() const {return beamId_p;}
97  const ROArrayColumn<Double>& beamOffset() const {return beamOffset_p;}
98  const ROArrayQuantColumn<Double>& beamOffsetQuant() const {
99  return beamOffsetQuant_p;}
100  const ROArrayMeasColumn<MDirection>& beamOffsetMeas() const
101  {return beamOffsetMeas_p;}
102  const ROScalarColumn<Int>& feedId() const {return feedId_p;}
103  const ROScalarColumn<Double>& interval() const {return interval_p;}
104  const ROScalarQuantColumn<Double>& intervalQuant() const {
105  return intervalQuant_p;}
106  const ROScalarColumn<Int>& numReceptors() const {return numReceptors_p;}
107  const ROArrayColumn<Complex>& polResponse() const {return polResponse_p;}
108  const ROArrayColumn<String>& polarizationType() const {
109  return polarizationType_p;}
110  const ROArrayColumn<Double>& position() const {return position_p;}
111  const ROArrayQuantColumn<Double>& positionQuant() const {
112  return positionQuant_p;}
113  const ROScalarMeasColumn<MPosition>& positionMeas() const
114  { return positionMeas_p;}
115  const ROArrayColumn<Double>& receptorAngle() const {return receptorAngle_p;}
116  const ROArrayQuantColumn<Double>& receptorAngleQuant() const {
117  return receptorAngleQuant_p;}
118  const ROScalarColumn<Int>& spectralWindowId() const {
119  return spectralWindowId_p;}
120  const ROScalarColumn<Double>& time() const {return time_p;}
121  const ROScalarQuantColumn<Double>& timeQuant() const {
122  return timeQuant_p;}
123  const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;}
124  // </group>
125 
126  // Access to optional columns
127  // <group>
128  const ROScalarColumn<Double>& focusLength() const {return focusLength_p;}
129  const ROScalarQuantColumn<Double>& focusLengthQuant() const {
130  return focusLengthQuant_p;}
131  const ROScalarColumn<Int>& phasedFeedId() const {return phasedFeedId_p;}
132  // </group>
133 
134  // Convenience function that returns the number of rows in any of the columns
135  uInt nrow() const {return antennaId_p.nrow();}
136 
137  // Returns the last row that contains a feed with the specified values.
138  // If no matching row can be found, but a match is possible if the validity
139  // time interval is widened, return that row and the suggestion for the
140  // new time information.
141  // If no change to time is necessary, newTimeQ and newIntervalQ are zero.
142  // Returns -1 if no match could be found.
143  // Ignore the Feed table rows contained in vector ignoreRows.
144  // focusLengthQ is only compared if this optional column is present and
145  // if the value of focusLengthQ is not dimensionless.
146  Int matchFeed(Quantum<Double>& newTimeQ,
147  Quantum<Double>& newIntervalQ,
148  const Int& antId,
149  const Int& fId, // feedId
150  const Int& spwId,
151  const Quantum<Double>& timeQ,
152  const Quantum<Double>& intervalQ,
153  const Int& numRec,
154  const Array<Quantum<Double> >& beamOffsetQ,
155  const Array<String>& polType,
156  const Array<Complex>& polResp,
157  const Array<Quantum<Double> >& positionQ,
158  const Array<Quantum<Double> >& receptorAngleQ,
159  const Vector<uInt>& ignoreRows,
160  const Quantum<Double>& focusLengthQ=Quantum<Double>()
161  );
162 
163 protected:
164  //# default constructor creates a object that is not usable. Use the attach
165  //# function correct this.
166  ROMSFeedColumns();
167 
168  //# attach this object to the supplied table.
169  void attach(const MSFeed& msFeed);
170 
171 private:
172  //# Make the assignment operator and the copy constructor private to prevent
173  //# any compiler generated one from being used.
176 
177  //# Check if any optional columns exist and if so attach them.
178  void attachOptionalCols(const MSFeed& msFeed);
179 
180  //# required columns
181  ROScalarColumn<Int> antennaId_p;
182  ROScalarColumn<Int> beamId_p;
183  ROArrayColumn<Double> beamOffset_p;
184  ROScalarColumn<Int> feedId_p;
185  ROScalarColumn<Double> interval_p;
186  ROScalarColumn<Int> numReceptors_p;
187  ROArrayColumn<Complex> polResponse_p;
188  ROArrayColumn<String> polarizationType_p;
189  ROArrayColumn<Double> position_p;
190  ROArrayColumn<Double> receptorAngle_p;
191  ROScalarColumn<Int> spectralWindowId_p;
192  ROScalarColumn<Double> time_p;
193  //# optional columns
194  ROScalarColumn<Double> focusLength_p;
195  ROScalarColumn<Int> phasedFeedId_p;
196 
197  // Access to Measure columns
198  ROArrayMeasColumn<MDirection> beamOffsetMeas_p;
199  ROScalarMeasColumn<MPosition> positionMeas_p;
200  ROScalarMeasColumn<MEpoch> timeMeas_p;
201 
202  // Access to Quantum columns
203  ROArrayQuantColumn<Double> beamOffsetQuant_p;
204  ROScalarQuantColumn<Double> intervalQuant_p;
205  ROArrayQuantColumn<Double> positionQuant_p;
206  ROArrayQuantColumn<Double> receptorAngleQuant_p;
207  ROScalarQuantColumn<Double> timeQuant_p;
208  //# optional Quantum columns
209  ROScalarQuantColumn<Double> focusLengthQuant_p;
210 };
211 
212 // <summary>
213 // A class to provide easy read-write access to MSFeed columns
214 // </summary>
215 
216 // <use visibility=export>
217 
218 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
219 // </reviewed>
220 
221 // <prerequisite>
222 // <li> MSFeed
223 // <li> ArrayColumn
224 // <li> ScalarColumn
225 // </prerequisite>
226 //
227 // <etymology>
228 // MSFeedColumns stands for MeasurementSet Feed Table columns.
229 // </etymology>
230 //
231 // <synopsis>
232 // This class provides access to the columns in the MSFeed Table,
233 // it does the declaration of all the Scalar and ArrayColumns with the
234 // correct types, so the application programmer doesn't have to
235 // worry about getting those right. There is an access function
236 // for every predefined column. Access to non-predefined columns will still
237 // have to be done with explicit declarations.
238 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
239 // </synopsis>
240 //
241 // <motivation>
242 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
243 // </motivation>
244 
246 {
247 public:
248  // Create a columns object that accesses the data in the specified Table
249  MSFeedColumns(MSFeed& msFeed);
250 
251  // The desctructor does nothing special
252  ~MSFeedColumns();
253 
254  // Read-write access to required columns
255  // <group>
261  {return beamOffsetMeas_p;}
271  { return positionMeas_p;}
274  return receptorAngleQuant_p;}
279  // </group>
280 
281  // Read-write access to optional columns
282  // <group>
286  // </group>
287 
288  // Read-only access to required columns
289  // <group>
290  const ROScalarColumn<Int>& antennaId() const {
291  return ROMSFeedColumns::antennaId();}
292  const ROScalarColumn<Int>& beamId() const {
293  return ROMSFeedColumns::beamId();}
294  const ROArrayColumn<Double>& beamOffset() const {
295  return ROMSFeedColumns::beamOffset();}
296  const ROArrayQuantColumn<Double>& beamOffsetQuant() const {
298  const ROArrayMeasColumn<MDirection>& beamOffsetMeas() const {
300  const ROScalarColumn<Int>& feedId() const {
301  return ROMSFeedColumns::feedId();}
302  const ROScalarColumn<Double>& interval() const {
303  return ROMSFeedColumns::interval();}
304  const ROScalarQuantColumn<Double>& intervalQuant() const {
306  const ROScalarColumn<Int>& numReceptors() const {
308  const ROArrayColumn<Complex>& polResponse() const {
310  const ROArrayColumn<String>& polarizationType() const {
312  const ROArrayColumn<Double>& position() const {
313  return ROMSFeedColumns::position();}
314  const ROArrayQuantColumn<Double>& positionQuant() const {
316  const ROScalarMeasColumn<MPosition>& positionMeas() const {
318  const ROArrayColumn<Double>& receptorAngle() const {
320  const ROArrayQuantColumn<Double>& receptorAngleQuant() const {
322  const ROScalarColumn<Int>& spectralWindowId() const {
324  const ROScalarColumn<Double>& time() const {
325  return ROMSFeedColumns::time();}
326  const ROScalarQuantColumn<Double>& timeQuant() const {
327  return ROMSFeedColumns::timeQuant();}
328  const ROScalarMeasColumn<MEpoch>& timeMeas() const {
329  return ROMSFeedColumns::timeMeas();}
330  // </group>
331 
332  // Read-only access to optional columns
333  // <group>
334  const ROScalarColumn<Double>& focusLength() const {
336  const ROScalarQuantColumn<Double>& focusLengthQuant() const {
338  const ROScalarColumn<Int>& phasedFeedId() const {
340  // </group>
341 
342  // set the epoch type for the TIME column.
343  // <note role=tip>
344  // In principle this function can only be used if the table is empty,
345  // otherwise already written values may thereafter have an incorrect
346  // reference, offset, or unit. However, it is possible that part of the
347  // table gets written before these values are known. In that case the
348  // reference, offset, or units can be set by using a False
349  // <src>tableMustBeEmpty</src> argument.
350  // </note>
351  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
352 
353  // set the direction type for the BEAM_OFFSET column. This can only be done
354  // when the table has no rows. Trying to do so at other times will throw an
355  // exception.
357 
358  // set the position type for the POSITION column. This can only be done when
359  // the table has no rows. Trying to do so at other times will throw an
360  // exception.
362 
363 protected:
364  //# default constructor creates a object that is not usable. Use the attach
365  //# function correct this.
366  MSFeedColumns();
367 
368  //# attach this object to the supplied table.
369  void attach(MSFeed& msFeed);
370 
371 private:
372  //# Make the assignment operator and the copy constructor private to prevent
373  //# any compiler generated one from being used.
376 
377  //# Check if any optional columns exist and if so attach them.
378  void attachOptionalCols(MSFeed& msFeed);
379 
380  //# required columns
393  //# optional columns
396 
397  //# Access to Measure columns
401 
402  //# Access to Quantum columns
408  //# optional Quantum columns
410 };
411 
412 } //# NAMESPACE CASACORE - END
413 
414 #endif
ScalarQuantColumn< Double > intervalQuant_p
ROArrayColumn< String > polarizationType_p
ScalarColumn< Int > feedId_p
int Int
Definition: aipstype.h:50
ROArrayQuantColumn< Double > positionQuant_p
ArrayQuantColumn< Double > & receptorAngleQuant()
const ROArrayColumn< Double > & position() const
const ROArrayColumn< Complex > & polResponse() const
const ROArrayColumn< Double > & receptorAngle() const
ArrayMeasColumn< MDirection > & beamOffsetMeas()
ScalarColumn< Double > & interval()
const ROArrayColumn< Double > & position() const
const ROScalarColumn< Int > & spectralWindowId() const
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
ROScalarColumn< Int > antennaId_p
ArrayColumn< String > polarizationType_p
const ROScalarColumn< Int > & antennaId() const
Read-only access to required columns.
const ROScalarColumn< Int > & spectralWindowId() const
ROScalarQuantColumn< Double > intervalQuant_p
ArrayQuantColumn< Double > & beamOffsetQuant()
void attach(MSFeed &msFeed)
ArrayColumn< Double > position_p
const ROArrayQuantColumn< Double > & positionQuant() const
ScalarMeasColumn< MEpoch > timeMeas_p
const ROScalarQuantColumn< Double > & timeQuant() const
void setDirectionRef(MDirection::Types ref)
set the direction type for the BEAM_OFFSET column.
const ROScalarColumn< Int > & phasedFeedId() const
ScalarColumn< Int > & feedId()
const ROArrayQuantColumn< Double > & beamOffsetQuant() const
const ROScalarColumn< Double > & interval() const
ArrayQuantColumn< Double > beamOffsetQuant_p
A Table intended to hold a MeasurementSet FEED table.
Definition: MSFeed.h:78
ArrayColumn< Double > beamOffset_p
ScalarQuantColumn< Double > & timeQuant()
~MSFeedColumns()
The desctructor does nothing special.
const ROScalarQuantColumn< Double > & focusLengthQuant() const
ROArrayColumn< Complex > polResponse_p
MSFeedColumns & operator=(const MSFeedColumns &)
const ROArrayColumn< Complex > & polResponse() const
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
ArrayColumn< Double > & position()
ArrayColumn< Complex > polResponse_p
ROArrayQuantColumn< Double > receptorAngleQuant_p
const ROScalarColumn< Int > & phasedFeedId() const
ROScalarColumn< Double > time_p
ScalarQuantColumn< Double > timeQuant_p
ScalarColumn< Int > phasedFeedId_p
const ROScalarQuantColumn< Double > & intervalQuant() const
ROMSFeedColumns & operator=(const ROMSFeedColumns &)
void attachOptionalCols(MSFeed &msFeed)
ArrayColumn< Double > receptorAngle_p
const ROArrayMeasColumn< MDirection > & beamOffsetMeas() const
const ROScalarMeasColumn< MPosition > & positionMeas() const
ScalarMeasColumn< MPosition > positionMeas_p
const ROScalarColumn< Int > & feedId() const
ROScalarQuantColumn< Double > timeQuant_p
ROArrayColumn< Double > receptorAngle_p
ROArrayQuantColumn< Double > beamOffsetQuant_p
Access to Quantum columns.
ScalarColumn< Double > time_p
ScalarColumn< Int > beamId_p
ArrayColumn< String > & polarizationType()
ScalarQuantColumn< Double > focusLengthQuant_p
ROScalarColumn< Double > focusLength_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ScalarMeasColumn< MEpoch > & timeMeas()
const ROScalarMeasColumn< MPosition > & positionMeas() const
const ROScalarColumn< Double > & time() const
const ROScalarColumn< Int > & antennaId() const
Access to required columns.
Definition: MSFeedColumns.h:95
ScalarQuantColumn< Double > & intervalQuant()
ScalarColumn< Double > & focusLength()
Read-write access to optional columns.
ArrayMeasColumn< MDirection > beamOffsetMeas_p
const ROArrayColumn< String > & polarizationType() const
ScalarColumn< Int > numReceptors_p
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
A class to provide easy read-write access to MSFeed columns.
const ROScalarMeasColumn< MEpoch > & timeMeas() const
ArrayColumn< Complex > & polResponse()
const ROArrayColumn< Double > & beamOffset() const
Definition: MSFeedColumns.h:97
ScalarMeasColumn< MPosition > & positionMeas()
ROScalarColumn< Int > numReceptors_p
const ROArrayQuantColumn< Double > & positionQuant() const
ArrayColumn< Double > & beamOffset()
void attachOptionalCols(const MSFeed &msFeed)
const ROScalarColumn< Int > & feedId() const
const ROArrayColumn< Double > & receptorAngle() const
const ROScalarQuantColumn< Double > & timeQuant() const
const ROScalarColumn< Double > & time() const
ROScalarColumn< Int > phasedFeedId_p
A class to provide easy read-only access to MSFeed columns.
Definition: MSFeedColumns.h:84
const ROArrayColumn< String > & polarizationType() const
ArrayQuantColumn< Double > positionQuant_p
const ROScalarColumn< Double > & interval() const
const ROArrayMeasColumn< MDirection > & beamOffsetMeas() const
ScalarColumn< Int > & spectralWindowId()
ScalarColumn< Double > focusLength_p
const ROScalarMeasColumn< MEpoch > & timeMeas() const
ROScalarMeasColumn< MPosition > positionMeas_p
ScalarColumn< Int > & numReceptors()
ROScalarQuantColumn< Double > focusLengthQuant_p
ROScalarColumn< Double > interval_p
ROScalarColumn< Int > beamId_p
ScalarColumn< Int > spectralWindowId_p
ROArrayMeasColumn< MDirection > beamOffsetMeas_p
Access to Measure columns.
ROScalarMeasColumn< MEpoch > timeMeas_p
ROArrayColumn< Double > position_p
ScalarColumn< Int > antennaId_p
ScalarColumn< Double > interval_p
ScalarColumn< Int > & antennaId()
Read-write access to required columns.
ScalarQuantColumn< Double > & focusLengthQuant()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
ScalarColumn< Double > & time()
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
const ROArrayQuantColumn< Double > & receptorAngleQuant() const
const ROScalarQuantColumn< Double > & intervalQuant() const
const ROScalarColumn< Int > & numReceptors() const
~ROMSFeedColumns()
The destructor does nothing special.
const ROArrayQuantColumn< Double > & receptorAngleQuant() const
ROScalarColumn< Int > feedId_p
ROArrayColumn< Double > beamOffset_p
const ROScalarColumn< Double > & focusLength() const
Read-only access to optional columns.
ArrayQuantColumn< Double > receptorAngleQuant_p
const Bool True
Definition: aipstype.h:43
const ROArrayColumn< Double > & beamOffset() const
ScalarColumn< Int > & phasedFeedId()
const ROScalarColumn< Int > & numReceptors() const
ROScalarColumn< Int > spectralWindowId_p
const ROScalarColumn< Int > & beamId() const
Definition: MSFeedColumns.h:96
ScalarColumn< Int > & beamId()
ArrayQuantColumn< Double > & positionQuant()
const ROScalarColumn< Int > & beamId() const
void attach(const MSFeed &msFeed)
unsigned int uInt
Definition: aipstype.h:51
const ROArrayQuantColumn< Double > & beamOffsetQuant() const
Definition: MSFeedColumns.h:98
const ROScalarColumn< Double > & focusLength() const
Access to optional columns.
Int matchFeed(Quantum< Double > &newTimeQ, Quantum< Double > &newIntervalQ, const Int &antId, const Int &fId, const Int &spwId, const Quantum< Double > &timeQ, const Quantum< Double > &intervalQ, const Int &numRec, const Array< Quantum< Double > > &beamOffsetQ, const Array< String > &polType, const Array< Complex > &polResp, const Array< Quantum< Double > > &positionQ, const Array< Quantum< Double > > &receptorAngleQ, const Vector< uInt > &ignoreRows, const Quantum< Double > &focusLengthQ=Quantum< Double >())
Returns the last row that contains a feed with the specified values.
ArrayColumn< Double > & receptorAngle()
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
const ROScalarQuantColumn< Double > & focusLengthQuant() const