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