casacore
Loading...
Searching...
No Matches
MDirection.h
Go to the documentation of this file.
1// # MDirection.h: A Measure: astronomical direction
2// # Copyright (C) 1995-2000,2002,2004,2007
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 MEASURES_MDIRECTION_H
27#define MEASURES_MDIRECTION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/measures/Measures/MeasBase.h>
32#include <casacore/measures/Measures/MeasRef.h>
33#include <casacore/casa/Quanta/MVDirection.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class MDirection;
39class MCDirection;
40template <class M>
41class MeasConvert;
42template <class M>
43class ArrayMeasColumn;
44template <class M>
46
47// # Typedefs
48
49// <summary>
50// A Measure: astronomical direction
51// </summary>
52
53// <use visibility=export>
54
55// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
56// </reviewed>
57
58// <prerequisite>
59// <li> <linkto class=Measure>Measure</linkto> class
60// </prerequisite>
61//
62// <etymology>
63// </etymology>
64//
65// <synopsis>
66// MDirection forms a derived Measure class for a direction in space.<br>
67// An MDirection can be generated from a
68// <linkto class=MVDirection>MVDirection</linkto> or a pair of
69// <linkto class=Quantum>Quantities</linkto> specifying a longitudinal and a
70// latitudinal angle.<br>
71// The different reference types that can be used for a Direction are:
72// <ul>
73// <li>MDirection::J2000 -- mean equator and equinox at J2000.0 (FK5)
74// <li>MDirection::JNAT --- geocentric natural frame
75// <li>MDirection::JMEAN -- mean equator and equinox at frame epoch
76// <li>MDirection::JTRUE -- true equator and equinox at frame epoch
77// <li>MDirection::APP ---- apparent geocentric position
78// <li>MDirection::B1950 -- mean epoch and ecliptic at B1950.0. The epoch
79// is taken from the frame epoch; or from the aipsrc variable
80// measures.b1950.d_epoch; or has default 2000.0
81// <li>MDirection::B1950_VLA -- mean epoch(1979.9)) and ecliptic at B1950.0
82// <li>MDirection::BMEAN -- mean equator and equinox at frame epoch
83// <li>MDirection::BTRUE -- true equator and equinox at frame epoch
84// <li>MDirection::GALACTIC -- galactic coordinates
85// <li>MDirection::HADEC -- topocentric HA and declination
86// <li>MDirection::AZEL --- topocentric Azimuth and Elevation (N through E)
87// <li>MDirection::AZELSW - topocentric Azimuth and Elevation (S through W)
88// <li>MDirection::AZELNE - topocentric Azimuth and Elevation (N through E)
89// <li>MDirection::AZELGEO --- geodetic Azimuth and Elevation (N through E)
90// <li>MDirection::AZELSWGEO - geodetic Azimuth and Elevation (S through W)
91// <li>MDirection::AZELNEGEO - geodetic Azimuth and Elevation (N through E)
92// <li>MDirection::ECLIPTC -- ecliptic for J2000 equator and equinox
93// <li>MDirection::MECLIPTIC -- ecliptic for mean equator of date
94// <li>MDirection::TECLIPTIC -- ecliptic for true equator of date
95// <li>MDirection::SUPERGAL -- supergalactic coordinates
96// <li>MDirection::ITRF -- coordinates wrt ITRF Earth frame
97// <li>MDirection::TOPO -- apparent topocentric position
98// <li>MDirection::ICRS -- International Celestial reference system
99// <li>MDirection::MERCURY -- the planet: has no data attached
100// <li>MDirection::VENUS
101// <li>MDirection::MARS
102// <li>MDirection::JUPITER
103// <li>MDirection::SATURN
104// <li>MDirection::URANUS
105// <li>MDirection::NEPTUNE
106// <li>MDirection::PLUTO
107// <li>MDirection::SUN
108// <li>MDirection::MOON
109// <li>MDirection::COMET -- solar system body: no coordinates attached,
110// only table
111// <li>MDirection::DEFAULT = J2000
112// </ul>
113// <p>
114// Conversion between the different types is done with the standard
115// <linkto class=MeasConvert>MeasConvert</linkto> class
116// (<src>MDirection::Convert</src> in this case).<br>
117// For some conversion additional <linkto class=MeasFrame>MeasFrame</linkto>
118// information is essential. The following list specifies which information
119// is needed if the conversion goes to or from the different types:
120// <ul>
121// <li><em>Epoch</em>: all but J2000, B1950, GALACTIC, SUPGAL, ECLIPTIC, ICRS
122// <li><em>Positiom</em>: HADEC, AZEL, AZELGEO
123// </ul>
124// The conversion between B1950 and J2000 may have an Epoch. If none given
125// an epoch of 2000.0 is assumed for the conversion, unless an aipsrc
126// variable <em>measures.b1950.d_epoch</em> is given.
127//
128// Conversions are based on the IAU system of
129// <linkto class=Precession>precession</linkto> and
130// <linkto class=Nutation>nutation</linkto> (with
131// IERS corrections if available); and on series expansions of the DE200
132// planetary ephemeris (J system; for B sytem older expansions) for the
133// <linkto class=Aberration>aberration</linkto> and the
134// <linkto class=SolarPos>solar position</linkto>.<br>
135// The <em>HADEC</em> position has corrections for polar motion and the
136// equation of equinoxes; the <em>AZEL</em> will include Earth tides and
137// refraction at a later stage.<br>
138// Note that conversion between B1950 and J2000 can only be approximate, and is
139// based on FK4 to FK5 conversion. The best conversion is to convert first
140// to an apparent position at the time of observation, and convert from there
141// to the other standard (the correct route will be followed).<br>
142// Another problem can arise if the source has proper motion and/or radial
143// velocities. These should be taken into account. An
144// MCatalog class will maybe take care of that.
145// <note role=warning>
146// The offset that can be specified in the MDirection::Ref is an MDirection
147// offset, and can not be used for specifying angular offsets. shift()
148// methods are available for these cases.
149// </note>
150// <p>
151// To aid in formatting of the angles without having to check all difference
152// referencetypes, the following global types are provided:
153// <ul>
154// <li> GRADEC for types that are probably expressed in HM,DM
155// <li> GHADEC for types that are probably expressed in +-HM,DM
156// <li> GAZEL for types that are probably expressed in +-deg,deg
157// <li> GLONGLAT for types that are probably expressed in deg,deg
158// </ul>
159// they can be obtained with the globalType() method.
160// </synopsis>
161//
162// <example>
163// See <linkto module=Measures>Measures</linkto> module description for
164// extensive examples.
165// </example>
166//
167// <motivation>
168// </motivation>
169//
170// <todo asof="2000/06/15">
171// <li>
172// </todo>
173
174class MDirection : public MeasBase<MVDirection, MeasRef<MDirection>> {
175 public:
176 // # Friends
177 // Conversion of data
178 friend class MeasConvert<MDirection>;
179
180 // # Enumerations
181 // Types of known MDirections
182 // <note role=warning> The order defines the order in the translation matrix FromTo
183 // in the getConvert routine. Do not change the order without
184 // changing the array. Additions should be made before N_types, and
185 // an additional row and column should be coded in FromTo, and
186 // in showType().</note>
233 // Global types
235
236 // # Typedefs
237 // Measure value container for this class (i.e. MDirection::MVType)
239 // Measure conversion routines for this class (i.e. MDirection::MCType)
241 // Measure reference (i.e. MDirection::Ref)
243 // Measure Convert (i.e. MDirection::Convert)
245 // Measure table Columns (e.g., MDirection::ScalarColumn)
248
249 // # Constructors
250 // <note role=tip> In the following constructors and other functions, all
251 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
252 // where no offsets or frames are needed in the reference. </note>
253 // Default constructor; generates the J2000 pole direction
255 // Create from data and reference
256 // <group>
260 MDirection(const Quantity &dt, const Quantity &dt1);
261 MDirection(const Quantity &dt, const Quantity &dt1, const MDirection::Ref &rf);
262 MDirection(const Quantity &dt, const Quantity &dt1, MDirection::Types rf);
266 MDirection(const Measure *dt);
270 // </group>
271
272 // # Destructor
273 virtual ~MDirection();
274
275 // Make an MDirection object given the case-insensitive name of a
276 // moving source (ZENITH, SUN, etc.),
277 // or of a known standard source (CygA, etc.).
278 static MDirection makeMDirection(const String &sourceName);
279
280 // # Operators
281
282 // # General Member Functions
283 // Tell me your type ('Direction')
284 // <group>
285 virtual const String &tellMe() const;
286 static const String &showMe();
287 // </group>
288 // Assert you are a direction
289 static void assure(const Measure &in);
290 // Tell me the global type (like GRADEC) for tp (tp like MDirection::J2000)
292 // Translate reference code tp. The uInt version has a check for valid codes
293 // (i.e. it is a safe cast).
294 // <thrown>
295 // <li> AipsError in the uInt interface if illegal code given
296 // </thrown>
297 // <group>
300 static const String &showType(uInt tp);
301 // </group>
302 // Translate string to reference code
303 // <group>
304 static Bool getType(MDirection::Types &tp, const String &in);
306 // </group>
307 // Set the offset in the reference (False if non-matching Measure)
308 virtual Bool setOffset(const Measure &in);
309 // Set the reference type to the specified String. False if illegal
310 // string, reference set to DEFAULT.
311 virtual Bool setRefString(const String &in);
312 // Get the default reference type
313 virtual const String &getDefaultType() const;
314 // Get a list of all known reference codes. nall returns the number in list,
315 // nextra the number of specials (like planets) that should be at
316 // end of list). typ returns the list of corresponding types.
317 // <group>
318 virtual const String *allTypes(Int &nall, Int &nextra, const uInt *&typ) const;
319 static const String *allMyTypes(Int &nall, Int &nextra, const uInt *&typ);
320 // </group>
321 // Check if all internal tables of types (both enum and String) are
322 // complete and correct. This function is called automatically if and when
323 // necessary.
324 // <thrown>
325 // <li> AipsError if a (programming) error in the types.
326 // </thrown>
327 // <group>
328 virtual void checkTypes() const;
329 static void checkMyTypes();
330 // </group>
331 // Get the reference type (for records, including codes like R_)
332 virtual String getRefString() const;
333 // Tell me if you are a pure model (e.g. a planet)
334 virtual Bool isModel() const;
335
336 // Get Measure data
337 // <group>
339 Quantum<Vector<Double>> getAngle(const Unit &inunit) const;
340 // </group>
341 // Shift the direction in longitude (radians if Double) and/or latitude.
342 // If the trueAngle switch is True, the longitude shift will be in
343 // angular units perpendicular to the direction to pole, along a great
344 // circle. See <linkto class=MVDirection>MVDirection</linkto>
345 // for more details.
346 // <group>
347 void shift(const Quantum<Double> &lng, const Quantum<Double> &lat, Bool trueAngle = False);
348 void shift(Double lng, Double lat, Bool trueAngle = False);
349 void shiftLongitude(const Quantity &lng, Bool trueAngle = False);
350 void shiftLongitude(Double lng, Bool trueAngle = False);
351 void shiftLatitude(const Quantum<Double> &lat, Bool trueAngle = False);
352 void shiftLatitude(Double lat, Bool trueAngle = False);
353 void shift(const MVDirection &shft, Bool trueAngle = False);
354 // </group>
355 // Shift over an angle off in the direction pa. pa is measured from North,
356 // in the direction of increasing longitude.
357 // See <linkto class=MVDirection>MVDirection</linkto>
358 // for implementation.
359 // <group>
362 // </group>
363
364 // Make a copy
365 // <group>
366 virtual Measure *clone() const;
367 // </group>
368
369 // Convert to a String in astronomer-friendly format based on
370 // reference frame
372
373 private:
374 // # Data
375
376 // # Member functions
377};
378
379} // namespace casacore
380
381#endif
Bool giveMe(MDirection::Ref &mr, const String &in)
static void checkMyTypes()
void shift(const Quantum< Double > &lng, const Quantum< Double > &lat, Bool trueAngle=False)
Shift the direction in longitude (radians if Double) and/or latitude.
virtual String getRefString() const
Get the reference type (for records, including codes like R_).
MeasConvert< MDirection > Convert
Measure Convert (i.e.
Definition MDirection.h:244
void shift(Double lng, Double lat, Bool trueAngle=False)
void shiftLatitude(Double lat, Bool trueAngle=False)
Quantum< Vector< Double > > getAngle(const Unit &inunit) const
MDirection(MDirection::Types rf)
static Bool getType(MDirection::Types &tp, const String &in)
Translate string to reference code.
virtual const String & tellMe() const
Tell me your type ('Direction').
MDirection(const Quantum< Vector< Double > > &dt)
void shift(const MVDirection &shft, Bool trueAngle=False)
MVDirection MVType
Measure value container for this class (i.e.
Definition MDirection.h:238
ArrayMeasColumn< MDirection > ArrayColumn
Definition MDirection.h:247
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
virtual Measure * clone() const
Make a copy.
static const String & showType(uInt tp)
MDirection(const Quantity &dt, const Quantity &dt1, const MDirection::Ref &rf)
MDirection(const MDirection::Ref &rf)
void shiftLongitude(Double lng, Bool trueAngle=False)
MDirection(const Quantity &dt, const Quantity &dt1)
static const String & showMe()
static MDirection makeMDirection(const String &sourceName)
Make an MDirection object given the case-insensitive name of a moving source (ZENITH,...
virtual Bool isModel() const
Tell me if you are a pure model (e.g.
MDirection(const MVDirection &dt, MDirection::Types rf)
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
void shiftLongitude(const Quantity &lng, Bool trueAngle=False)
MDirection(const Quantum< Vector< Double > > &dt, const MDirection::Ref &rf)
MeasRef< MDirection > Ref
Measure reference (i.e.
Definition MDirection.h:242
MCDirection MCType
Measure conversion routines for this class (i.e.
Definition MDirection.h:240
static MDirection::Types castType(uInt tp)
Translate reference code tp.
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition MDirection.h:187
@ EXTRA
All extra bits.
Definition MDirection.h:226
@ COMET
Comet or other table-described solar system body.
Definition MDirection.h:223
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure).
Quantum< Vector< Double > > getAngle() const
Get Measure data.
void shiftAngle(Double off, Double pa)
MDirection(const Quantum< Vector< Double > > &dt, MDirection::Types rf)
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
static MDirection::GlobalTypes globalType(uInt tp)
Tell me the global type (like GRADEC) for tp (tp like MDirection::J2000).
GlobalTypes
Global types.
Definition MDirection.h:234
String toString() const
Convert to a String in astronomer-friendly format based on reference frame.
static void assure(const Measure &in)
Assert you are a direction.
MDirection(const MVDirection &dt)
Create from data and reference.
virtual const String & getDefaultType() const
Get the default reference type.
MDirection()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measu...
void shiftAngle(const Quantum< Double > &off, const Quantum< Double > &pa)
Shift over an angle off in the direction pa.
MDirection(const MeasValue *dt)
MDirection(const MVDirection &dt, const MDirection::Ref &rf)
void shiftLatitude(const Quantum< Double > &lat, Bool trueAngle=False)
ScalarMeasColumn< MDirection > ScalarColumn
Measure table Columns (e.g., MDirection::ScalarColumn).
Definition MDirection.h:246
MDirection(const Quantity &dt, const Quantity &dt1, MDirection::Types rf)
static const String & showType(MDirection::Types tp)
MDirection(const Measure *dt)
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
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53