casacore
Loading...
Searching...
No Matches
DerivedMSCal.h
Go to the documentation of this file.
1// # DerivedMSCal.h: Virtual column engine to return derived MS values
2// # Copyright (C) 2010
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 DERIVEDMSCAL_DERIVEDMSCAL_H
27#define DERIVEDMSCAL_DERIVEDMSCAL_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/derivedmscal/DerivedMC/MSCalEngine.h>
32#include <casacore/tables/DataMan/VirtColEng.h>
33
34namespace casacore {
35
36// <summary>
37// Virtual column engine to return derived MS values
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="" date="" tests="tDerivedMSCal.cc">
43// </reviewed>
44
45// <prerequisite>
46// # Classes you should understand before using this one.
47// <li> The Table Data Managers concept as described in module file
48// <linkto module="Tables:Data Managers">Tables.h</linkto>
49// <li> MeasurementSet
50// </prerequisite>
51
52// <synopsis>
53// DerivedMSCal makes it possible to have virtual columns for the derived
54// MeasurementSet values hourangle, parallactic angle, azimuth/elevation,
55// and local sidereal time. In this way such derived values appear to be
56// ordinary columns with the exception that no values can be put into them.
57//
58// The following columns can be defined:
59// <ul>
60// <li> HA is the hourangle of the pointing from the array center (observatory position).
61// <li> HA1 is the hourangle of the pointing from ANTENNA1.
62// <li> HA2 is the hourangle of the pointing from ANTENNA2.
63// <li> HADEC is the hourangle/DEC of the pointing from the array center (observatory position).
64// <li> HADEC1 is the hourangle/DEC of the pointing from ANTENNA1.
65// <li> HADEC2 is the hourangle/DEC of the pointing from ANTENNA2.
66// <li> LAST is the local sidereal time of the pointing from the array center.
67// <li> LAST1 is the local sidereal time of the pointing from ANTENNA1.
68// <li> LAST2 is the local sidereal time of the pointing from ANTENNA2.
69// <li> PA1 is the parallactic angle of the pointing from ANTENNA1.
70// <li> PA2 is the parallactic angle of the pointing from ANTENNA2.
71// <li> AZEL is the azimuth/elevation of the pointing from the array center.
72// <li> AZEL1 is the azimuth/elevation of the pointing from ANTENNA1.
73// <li> AZEL2 is the azimuth/elevation of the pointing from ANTENNA2.
74// <li> ITRF is the pointing in (time-dependent) ITRF coordinates.
75// <li> UVW_J2000 is the UVW coordinates in J2000 (in meters).
76// </ul>
77// All columns have data type double and unit radian (except UVW). The HADEC,
78// AZEL, ITRF and UVW columns are array columnns while the others are
79// scalar columns.
80//
81// This engine is meant for a MeasurementSet, but can be used for any table
82// containing an ANTENNA and FIELD subtable and the relevant columns in the
83// main table (ANTENNA1 and/or ANTENNA2, FIELD_ID, and TIME).
84// <br>In principle the array center is the Observatory position, which is
85// taken from the Measures Observatory table using the telescope name found
86// in the OBSERVATION subtable. However, if the subtable is not defined or
87// empty or if the telescope name is unknown, the position of the first antenna
88// is used as the array position.
89//
90// The engine can also be used for a CASA Calibration Table. It understands
91// how it references the MeasurementSets. Because calibration tables contain
92// no ANTENNA2 columns, columns XX2 are the same as XX1.
93// </synopsis>
94
95// <motivation>
96// It makes it possible to use generic table software (like querying,
97// plotting, tablebrowser) on these values.
98// </motivation>
99
100// <example>
101// The following example shows how to add such columns to an MS and use
102// them thereafter.
103// <srcblock>
104// // Open the table for update (to be able to add the columns).
105// Table tab ("tDerivedMSCal_tmp.tab", Table::Update);
106// // Define the columns and add them using DerivedMSCal.
107// TableDesc td;
108// td.addColumn (ScalarColumnDesc<double>("HA1"));
109// td.addColumn (ScalarColumnDesc<double>("HA2"));
110// td.addColumn (ScalarColumnDesc<double>("PA1"));
111// td.addColumn (ScalarColumnDesc<double>("PA2"));
112// DerivedMSCal dataMan;
113// tab.addColumn (td, dataMan);
114// // Print values of all rows.
115// ScalarColumn<double> ha1(tab, "HA1");
116// ScalarColumn<double> ha2(tab, "HA2");
117// ScalarColumn<double> pa1(tab, "PA1");
118// ScalarColumn<double> pa2(tab, "PA2");
119// for (rownr_t row=0; row<tab.nrow(); ++row) {
120// cout << ha1(row)<<' '<<ha2(row)<<' '<<pa1(row)<<' '<<pa2(row)<<endl;
121// }
122// </srcblock>
123// </example>
124
125// <todo asof="$DATE:$">
126// <li> Take care of the feeds and their offsets.
127// <li> Have a conversion engine per field/antenna/feed?
128// </todo>
129
131 public:
132 // Create the data manager.
134
135 // Create a Lofar storage manager with the given name.
136 // The specifications are part of the record (as created by dataManagerSpec).
137 explicit DerivedMSCal(const Record& spec);
138
140
141 // Clone this object.
142 virtual DataManager* clone() const;
143
144 // Prepare the object. It sets the Table object in the engine.
145 virtual void prepare();
146
147 // Get the type name of the data manager (i.e. DerivedMSCal).
148 virtual String dataManagerType() const;
149
150 // Record a record containing data manager specifications.
151 virtual Record dataManagerSpec() const;
152
153 // Columns can be added.
154 virtual Bool canAddColumn() const;
155
156 // Columns can be removed.
157 virtual Bool canRemoveColumn() const;
158
159 // Make the object from the type name string.
160 // This function gets registered in the DataManager "constructor" map.
161 // The caller has to delete the object.
162 // The dataManName is not used.
163 static DataManager* makeObject(const String& dataManName, const Record& spec);
164
165 // Register the class name and the static makeObject "constructor".
166 // This will make the engine known to the table system.
167 static void registerClass();
168
169 private:
170 // Copy constructor cannot be used.
172
173 // Assignment cannot be used.
175
176 // Do the final addition of a column.
177 // It won't do anything.
179
180 // Remove a column from the data file.
181 // It won't do anything.
183
184 // Create a column in the storage manager on behalf of a table column.
185 // The caller has to delete the newly created object.
186 // <group>
187 // Create a scalar column.
188 virtual DataManagerColumn* makeScalarColumn(const String& aName, int aDataType,
189 const String& aDataTypeID);
190 // Create an indirect array column.
191 virtual DataManagerColumn* makeIndArrColumn(const String& aName, int aDataType,
192 const String& aDataTypeID);
193 // </group>
194
195 // # Declare member variables.
197 vector<DataManagerColumn*> itsColumns;
198};
199
200} // namespace casacore
201
202#endif
Abstract base class for a data manager.
static DataManager * makeObject(const String &dataManName, const Record &spec)
Make the object from the type name string.
virtual Bool canRemoveColumn() const
Columns can be removed.
DerivedMSCal(const Record &spec)
Create a Lofar storage manager with the given name.
DerivedMSCal & operator=(const DerivedMSCal &that)
Assignment cannot be used.
static void registerClass()
Register the class name and the static makeObject "constructor".
virtual Record dataManagerSpec() const
Record a record containing data manager specifications.
virtual Bool canAddColumn() const
Columns can be added.
virtual void addColumn(DataManagerColumn *)
Do the final addition of a column.
virtual DataManagerColumn * makeScalarColumn(const String &aName, int aDataType, const String &aDataTypeID)
Create a column in the storage manager on behalf of a table column.
virtual void removeColumn(DataManagerColumn *)
Remove a column from the data file.
vector< DataManagerColumn * > itsColumns
virtual DataManager * clone() const
Clone this object.
DerivedMSCal()
Create the data manager.
virtual String dataManagerType() const
Get the type name of the data manager (i.e.
virtual void prepare()
Prepare the object.
DerivedMSCal(const DerivedMSCal &that)
Copy constructor cannot be used.
virtual DataManagerColumn * makeIndArrColumn(const String &aName, int aDataType, const String &aDataTypeID)
Create an indirect array column.
String: the storage and methods of handling collections of characters.
Definition String.h:355
VirtualColumnEngine()
Create the object.
Definition VirtColEng.h:110
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40