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 public:
96 // Default constructor makes an object where all the
97 // parameters are set to their default values (see below)
99
100 // Destructor
102
103 // Copy all fields from "other" to this object. Uses copy semantics.
104 // <group>
105 ObsInfo(const ObsInfo &other);
106 ObsInfo &operator=(const ObsInfo &other);
107 // </group>
108
109 // Telescope identifier. If this is a "standard" telescope, you should use
110 // the same name as is available in the Observatories method of class
111 // <linkto class=MeasTable>MeasTable</linkto>. Defaults to "UNKNOWN".
112 // <br>
113 // The telescope position can be set and will be converted to ITRF.
114 // If the telescope position has not been set explicitly, it will be
115 // set for a standard telescope found in the MeasTable.
116 // <group>
120 const MPosition &telescopePosition() const { return telPosition_p; }
123 // </group>
124
125 // The name (or initials) of the observer. Defaults to "UNKNOWN".
126 // <group>
129 // </group>
130
131 // When was the observation taken (start time)? This is somewhat
132 // problematical for observations which are taken at multiple
133 // epochs. You should use the start time of the first sample.
134 // The default is the MEpoch default: MJD 0 UTC
135 // <group>
138 // </group>
139
140 // What was the pointing centre, as distinct from the phase centre ?
141 // This value is specified as an MVDirection.
142 // This means it is you, the callers responsibility, to know what its reference
143 // type is in order to turn it into an MDirection.
144 // The default is (0,0) (or [1,0,0]). After you have called setPointingCenter,
145 // the function isPointingCenterInitial will return False.
146 // <group>
149 // </group>
150
151 // Because the default pointing center is a valid value (0,0), this
152 // function is available to tell you whether the pointing center has
153 // been set (with setPointingCenter) to some value other than its
154 // initial (return False)
156
157 // Functions to interconvert between an ObsInfo and a record. These
158 // functions are inherited from class
159 // <linkto class=RecordTransformable>RecordTransformable</linkto>. As new
160 // fields get added to ObsInfo these functions should be augmented. Missing
161 // fields should not generate an error to in fromRecord to allow for
162 // backwards compatibility - null values should be supplied instead.
163 // The field names are "observer", "telescope", "obsdate", and
164 // "pointingcenter"
165 // <group>
166 virtual Bool toRecord(String &error, RecordInterface &outRecord) const;
167 virtual Bool fromRecord(String &error, const RecordInterface &inRecord);
168 // </group>
169
170 // Functions to interconvert between an ObsInfo and FITS keywords
171 // (converted to a Record). For the pointing center, the FITS
172 // keywords OBSRA and OBSDEC are used. Failure of <src>fromFITS</src>
173 // should probably not be regarded as fatal as the default ObsInfo
174 // values are viable. For each item contained
175 // in the ObsInfo, an attempt to decode it from FITS is made.
176 // If any of them fail, False is returned, but it attempts to decode
177 // them all. For those that fail
178 // an error message is held in <src>error</src>
179 // in the order telescope (error(0)), observer (error(1)), date
180 // (error(2)), pointing center (error(3)). <src>error</src> will
181 // be returned of length 0 if the return value is True, else
182 // it will be length 4.
183 // <group>
184 Bool toFITS(String &error, RecordInterface &outRecord) const;
185 Bool fromFITS(Vector<String> &error, const RecordInterface &inRecord);
186
187 // In some circumstances it might be useful to know what the defaults for
188 // the various values are so you can check if they have been set.
189 // <group>
194 // </group>
195
196 // It might be useful to know what FITS keyword names are used in to/from
197 // FITS so we can remove them so they won't be used more than once. The
198 // names are in lower case.
200
201 private:
208 Bool isPointingCenterInitial_p; // True when ObsInfo contructed.
209 // False after setPointingCenter called
210
211 // Common copy ctor/assignment operator code.
212
213 void copy_other(const ObsInfo &other);
214};
215
216// <summary> Global functions </summary>
217// <group name=Output>
218// Output declaration - useful for debugging.
219ostream &operator<<(ostream &os, const ObsInfo &info);
220// </group>
222} // namespace casacore
223
224#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:202
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:155
ObsInfo & setObserver(const String &observer)
Bool isPointingCenterInitial_p
Definition ObsInfo.h:208
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:206
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:119
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:207
String observer_p
Definition ObsInfo.h:203
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 ?
ObsInfo & setTelescope(const String &telescope)
MEpoch obsDate() const
When was the observation taken (start time)?
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:205
const MPosition & telescopePosition() const
Definition ObsInfo.h:120
~ObsInfo()
Destructor.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
RecordInterface()
The default constructor creates an empty record with a variable structure.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40