casacore
Loading...
Searching...
No Matches
ObsInfo.h
Go to the documentation of this file.
1//# ObsInfo.h: Store miscellaneous information related to an observation
2//# Copyright (C) 1998,2000,2001
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 COORDINATES_OBSINFO_H
27#define COORDINATES_OBSINFO_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Utilities/RecordTransformable.h>
31
32#include <casacore/casa/BasicSL/String.h>
33#include <casacore/measures/Measures/MEpoch.h>
34#include <casacore/measures/Measures/MPosition.h>
35#include <casacore/casa/Quanta/MVDirection.h>
36
37//# Forward declarations
38#include <casacore/casa/iosfwd.h>
39
40namespace casacore { //# NAMESPACE CASACORE - BEGIN
41
42// <summary>
43// Store miscellaneous information related to an observation.
44// </summary>
45
46// <use visibility=export>
47
48// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
49// </reviewed>
50
51// <prerequisite>
52// <li> <linkto class=RecordTransformable>RecordTransformable</linkto>
53// <li> <linkto class=MEpoch>MEpoch</linkto>
54// </prerequisite>
55//
56// <synopsis>
57// This class is used to record miscellaneous information about an observation.
58// At present it contains the following:
59// <ol>
60// <li> Telescope name
61// <li> Observer name
62// <li> Observation date
63// <li> Pointing centre (as distinct from the phase center or tangent point)
64// </ol>
65// This list can easily be extended if necessary.
66//
67// This class has functions to interconvert with a record in a "lossless"
68// fashion, and to also interconvert between a record that contains a list of
69// FITS keywords.
70// </synopsis>
71//
72// <example>
73// The interface is a simple get/set interface. Note that the "set" methods
74// can be chained together since each set method returns a reference to its
75// object (rather like cout).
76// <srcblock>
77// ObsInfo oi;
78// oi.setTelescope("VLA").setObserver("Glendenning");
79// ...
80// cout << "The date observed is: " << oi.obsDate() << endl;
81// </srcblock>
82// </example>
83//
84// <motivation>
85// Record information to allow more full measures conversion, e.g. topo->lsr
86// requires observatory location and time. Also record in a typesafe way
87// image summary information users are used to from classic AIPS.
88// </motivation>
89//
90// <todo asof="2000/04/20">
91// <li> Nothing known
92// </todo>
93
95{
96public:
97
98 // Default constructor makes an object where all the
99 // parameters are set to their default values (see below)
101
102 // Destructor
104
105 // Copy all fields from "other" to this object. Uses copy semantics.
106 // <group>
107 ObsInfo(const ObsInfo &other);
108 ObsInfo &operator=(const ObsInfo &other);
109 // </group>
110
111 // Telescope identifier. If this is a "standard" telescope, you should use
112 // the same name as is available in the Observatories method of class
113 // <linkto class=MeasTable>MeasTable</linkto>. Defaults to "UNKNOWN".
114 // <br>
115 // The telescope position can be set and will be converted to ITRF.
116 // If the telescope position has not been set explicitly, it will be
117 // set for a standard telescope found in the MeasTable.
118 // <group>
124 { return telPosition_p; }
127 // </group>
128
129 // The name (or initials) of the observer. Defaults to "UNKNOWN".
130 // <group>
133 // </group>
134
135 // When was the observation taken (start time)? This is somewhat
136 // problematical for observations which are taken at multiple
137 // epochs. You should use the start time of the first sample.
138 // The default is the MEpoch default: MJD 0 UTC
139 // <group>
142 // </group>
143
144 // What was the pointing centre, as distinct from the phase centre ?
145 // This value is specified as an MVDirection.
146 // This means it is you, the callers responsibility, to know what its reference
147 // type is in order to turn it into an MDirection.
148 // The default is (0,0) (or [1,0,0]). After you have called setPointingCenter,
149 // the function isPointingCenterInitial will return False.
150 // <group>
153 // </group>
154
155 // Because the default pointing center is a valid value (0,0), this
156 // function is available to tell you whether the pointing center has
157 // been set (with setPointingCenter) to some value other than its
158 // initial (return False)
160
161
162 // Functions to interconvert between an ObsInfo and a record. These
163 // functions are inherited from class
164 // <linkto class=RecordTransformable>RecordTransformable</linkto>. As new
165 // fields get added to ObsInfo these functions should be augmented. Missing
166 // fields should not generate an error to in fromRecord to allow for
167 // backwards compatibility - null values should be supplied instead.
168 // The field names are "observer", "telescope", "obsdate", and
169 // "pointingcenter"
170 // <group>
171 virtual Bool toRecord(String & error, RecordInterface & outRecord) const;
172 virtual Bool fromRecord(String & error, const RecordInterface & inRecord);
173 // </group>
174
175 // Functions to interconvert between an ObsInfo and FITS keywords
176 // (converted to a Record). For the pointing center, the FITS
177 // keywords OBSRA and OBSDEC are used. Failure of <src>fromFITS</src>
178 // should probably not be regarded as fatal as the default ObsInfo
179 // values are viable. For each item contained
180 // in the ObsInfo, an attempt to decode it from FITS is made.
181 // If any of them fail, False is returned, but it attempts to decode
182 // them all. For those that fail
183 // an error message is held in <src>error</src>
184 // in the order telescope (error(0)), observer (error(1)), date
185 // (error(2)), pointing center (error(3)). <src>error</src> will
186 // be returned of length 0 if the return value is True, else
187 // it will be length 4.
188 // <group>
189 Bool toFITS(String & error, RecordInterface & outRecord) const;
190 Bool fromFITS(Vector<String>& error, const RecordInterface & inRecord);
191
192 // In some circumstances it might be useful to know what the defaults for
193 // the various values are so you can check if they have been set.
194 // <group>
199 // </group>
200
201 // It might be useful to know what FITS keyword names are used in to/from
202 // FITS so we can remove them so they won't be used more than once. The
203 // names are in lower case.
205
206private:
213 Bool isPointingCenterInitial_p; // True when ObsInfo contructed.
214 // False after setPointingCenter called
215
216// Common copy ctor/assignment operator code.
217
218 void copy_other(const ObsInfo &other);
219};
220
221// <summary> Global functions </summary>
222// <group name=Output>
223// Output declaration - useful for debugging.
224ostream &operator<<(ostream &os, const ObsInfo &info);
225// </group>
227
228} //# NAMESPACE CASACORE - END
229
230#endif
Bool toFITS(String &error, RecordInterface &outRecord) const
Functions to interconvert between an ObsInfo and FITS keywords (converted to a Record).
Bool fromFITS(Vector< String > &error, const RecordInterface &inRecord)
static MEpoch defaultObsDate()
String telescope_p
Definition ObsInfo.h:207
Bool isPointingCenterInitial() const
Because the default pointing center is a valid value (0,0), this function is available to tell you wh...
Definition ObsInfo.h:159
ObsInfo & setObserver(const String &observer)
Bool isPointingCenterInitial_p
Definition ObsInfo.h:213
String telescope() const
Telescope identifier.
static String defaultTelescope()
In some circumstances it might be useful to know what the defaults for the various values are so you ...
Bool isTelPositionSet_p
Definition ObsInfo.h:211
virtual Bool fromRecord(String &error, const RecordInterface &inRecord)
Initialise the class from a Record representation.
ObsInfo()
Default constructor makes an object where all the parameters are set to their default values (see bel...
ObsInfo & setPointingCenter(const MVDirection &direction)
ObsInfo & setObsDate(const MEpoch &obsDate)
String telescopePositionString() const
Bool isTelescopePositionSet() const
Definition ObsInfo.h:121
static String defaultObserver()
static MVDirection defaultPointingCenter()
void copy_other(const ObsInfo &other)
False after setPointingCenter called.
ObsInfo & operator=(const ObsInfo &other)
MVDirection pointingCenter_p
Definition ObsInfo.h:212
String observer_p
Definition ObsInfo.h:208
virtual Bool toRecord(String &error, RecordInterface &outRecord) const
Functions to interconvert between an ObsInfo and a record.
MVDirection pointingCenter() const
What was the pointing centre, as distinct from the phase centre ? This value is specified as an MVDir...
ObsInfo & setTelescope(const String &telescope)
MEpoch obsDate() const
When was the observation taken (start time)? This is somewhat problematical for observations which ar...
ObsInfo & setTelescopePosition(const MPosition &)
String observer() const
The name (or initials) of the observer.
static Vector< String > keywordNamesFITS()
It might be useful to know what FITS keyword names are used in to/from FITS so we can remove them so ...
ObsInfo(const ObsInfo &other)
Copy all fields from "other" to this object.
MPosition telPosition_p
Definition ObsInfo.h:210
const MPosition & telescopePosition() const
Definition ObsInfo.h:123
~ObsInfo()
Destructor.
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
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40