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
130
132{
133public:
134 // Create the data manager.
136
137 // Create a Lofar storage manager with the given name.
138 // The specifications are part of the record (as created by dataManagerSpec).
139 explicit DerivedMSCal (const Record& spec);
140
142
143 // Clone this object.
144 virtual DataManager* clone() const;
145
146 // Prepare the object. It sets the Table object in the engine.
147 virtual void prepare();
148
149 // Get the type name of the data manager (i.e. DerivedMSCal).
150 virtual String dataManagerType() const;
151
152 // Record a record containing data manager specifications.
153 virtual Record dataManagerSpec() const;
154
155 // Columns can be added.
156 virtual Bool canAddColumn() const;
157
158 // Columns can be removed.
159 virtual Bool canRemoveColumn() const;
160
161 // Make the object from the type name string.
162 // This function gets registered in the DataManager "constructor" map.
163 // The caller has to delete the object.
164 // The dataManName is not used.
165 static DataManager* makeObject (const String& dataManName,
166 const Record& spec);
167
168 // Register the class name and the static makeObject "constructor".
169 // This will make the engine known to the table system.
170 static void registerClass();
171
172private:
173 // Copy constructor cannot be used.
175
176 // Assignment cannot be used.
178
179 // Do the final addition of a column.
180 // It won't do anything.
182
183 // Remove a column from the data file.
184 // It won't do anything.
186
187 // Create a column in the storage manager on behalf of a table column.
188 // The caller has to delete the newly created object.
189 // <group>
190 // Create a scalar column.
192 int aDataType,
193 const String& aDataTypeID);
194 // Create an indirect array column.
196 int aDataType,
197 const String& aDataTypeID);
198 // </group>
199
200 //# Declare member variables.
202 vector<DataManagerColumn*> itsColumns;
203};
204
205
206} //# end namespace
207
208#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:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40