casacore
MRadialVelocity.h
Go to the documentation of this file.
1 //# MRadialVelocity.h: A Measure: radial velocity
2 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
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 MEASURES_MRADIALVELOCITY_H
30 #define MEASURES_MRADIALVELOCITY_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/measures/Measures/MeasBase.h>
35 #include <casacore/measures/Measures/MeasRef.h>
36 #include <casacore/casa/Quanta/MVRadialVelocity.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MRadialVelocity;
42 class MCRadialVelocity;
43 template <class M> class MeasConvert;
44 template <class M> class ArrayMeasColumn;
45 template <class M> class ScalarMeasColumn;
46 class MDoppler;
47 class MVDoppler;
48 
49 //# Typedefs
50 
51 // <summary>
52 // A Measure: radial velocity
53 // </summary>
54 
55 // <use visibility=export>
56 
57 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
58 // </reviewed>
59 
60 // <prerequisite>
61 // <li> <linkto class=Measure>Measure</linkto> class
62 // </prerequisite>
63 //
64 // <etymology>
65 // </etymology>
66 //
67 // <synopsis>
68 // MRadialVelocity is a derived Measure class for radial velocity.<br>
69 // An MRadialVelocity can be generated from a simple value (or an
70 // <linkto class=MVRadialVelocity>MVRadialVelocity</linkto> object), which is then
71 // interpreted as a RadialVelocity in m/s, and a reference, with an LSRK type
72 // as default.<br>
73 // It can also be generated from a Quantity, where the interpretation
74 // depends on the dimensionality of the Quantity:
75 // <ul>
76 // <li> velocity (e.g. AU/a)
77 // </ul>
78 // The different reference types of a RadialVelocity are:
79 // <ul>
80 // <li> MRadialVelocity::LSRD --- Local Standard of Rest (J2000) -- as the
81 // dynamical definition (IAU, [9,12,7] km/s in galactic coordinates)
82 // <li> MRadialVelocity::LSRK -- LSR as a kinematical (radio) definition --
83 // 20.0 km/s in direction ra,dec = [270,+30] deg (B1900.0)
84 // <li> MRadialVelocity::BARY -- Barycentric (J2000)
85 // <li> MRadialVelocity::GEO --- Geocentric
86 // <li> MRadialVelocity::TOPO -- Topocentric
87 // <li> MRadialVelocity::GALACTO -- Galacto centric (with rotation of 220 km/s
88 // in direction l,b = [90,0] deg.
89 // <li> MRadialVelocity::LGROUP -- Local group velocity -- 308km/s towards
90 // l,b = [105,-7] deg (F. Ghigo)
91 // <li> MRadialVelocity::CMB -- CMB velocity -- 369.5km/s towards
92 // l,b = [264.4, 48.4] deg (F. Ghigo)
93 // <li> MRadialVelocity::DEFAULT = LSRK
94 // </ul>
95 // <p>
96 // Conversion between the different types is done with the standard
97 // <linkto class=MeasConvert>MeasConvert</linkto> class
98 // (<src>MRadialVelocity::Convert</src> in this case).<br>
99 // Some of the conversions are only possible if frame information has been
100 // filled in. The following frame information is necessary if a conversion
101 // goes to or from the (different) specified types:
102 // <ul>
103 // <li><em>Epoch</em>: TOPO, GEO
104 // <li><em>Position</em>: TOPO
105 // <li><em>Direction</em> all
106 // </ul>
107 // <br>
108 // <note role=caution> For large radial velocities (of order c) the conversions are
109 // not precise, and not completely reversable, due to unknown transverse
110 // velocities, and the additive way in which corrections are done. They
111 // are correct to first order wrt relativistic effects
112 // </note>
113 // An MRadialVelocity can be created from an
114 // <linkto class=MDoppler>MDoppler</linkto>
115 // by the <src>fromDoppler()</src> member. It can be converted to an MDoppler
116 // with the <src>toDoppler()</src>. Comparable methods are available
117 // for <linkto class=MFrequency>MFrequency</linkto> as
118 // <src>toRadial()</src> and <src>fromRadial</src>.<br>
119 // </synopsis>
120 //
121 // <example>
122 // Get the Doppler shift for an oberved HI RadialVelocity of 100 km/s
123 // <srcblock>
124 // cout << "Redshift for 100 km/s: " <<
125 // MDoppler::Convert( MRadialVelocity( Quantity(100., "km/s"),
126 // MRadialVelocity::TOPO).toDoppler(),
127 // MDoppler::Z)() << endl;
128 // </srcblock>
129 // </example>
130 //
131 // <motivation>
132 // </motivation>
133 //
134 // <todo asof="2003/03/03">
135 // </todo>
136 
137 class MRadialVelocity : public MeasBase<MVRadialVelocity, MeasRef<MRadialVelocity> > {
138 
139  public:
140  //# Friends
141  // Conversion of data
143 
144  //# Enumerations
145  // Types of known MRadialVelocity
146  // <note role=warning> The order defines the order in the translation
147  // matrix FromTo
148  // in the getConvert routine. Do not change the order without
149  // changing the array. Additions should be made before N_types, and
150  // an additional row and column should be coded in FromTo, and
151  // in showType().</note>
152  enum Types {
162  // Defaults
164  // Synonyms
166 
167  //# Typedefs
168  // Measure value container for this class (i.e. MRadialVelocity::MVType)
170  // Measure conversion routines for this class (i.e. MRadialVelocity::MCType)
172  // Measure reference (i.e. MRadialVelocity::Ref)
174  // Measure conversion use (i.e. MRadialVelocity::Convert)
176  // Measure table Columns (e.g., MRadialVelocity::ScalarColumn)
179  // Reference enum Types (included originally for gcc 2.95)
181 
182  //# Constructors
183  // <note role=tip> In the following constructors and other functions, all
184  // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
185  // where no offsets or frames are needed in the reference. </note>
186  // Default constructor; generates a zero rest RadialVelocity
187  MRadialVelocity();
188  // Create from data and reference
189  // <group>
193  MRadialVelocity(const Quantity &dt);
194  MRadialVelocity(const Quantity &dt, const MRadialVelocity::Ref &rf);
196  MRadialVelocity(const Measure *dt);
197  MRadialVelocity(const MeasValue *dt);
198  // </group>
199 
200  //# Destructor
201  virtual ~MRadialVelocity();
202 
203  //# Operators
204 
205  //# General Member Functions
206  // Tell me your type
207  // <group>
208  virtual const String &tellMe() const;
209  static const String &showMe();
210  virtual uInt type() const;
211  static void assure(const Measure &in);
212  // </group>
213  // Translate reference code. The uInt version has a check for valid codes
214  // (i.e. it is a safe cast).
215  // <thrown>
216  // <li> AipsError in the uInt interface if illegal code given
217  // </thrown>
218  // <group>
220  static const String &showType(MRadialVelocity::Types tp);
221  static const String &showType(uInt tp);
222  // </group>
223  // Translate string to reference code
224  // <group>
225  static Bool getType(MRadialVelocity::Types &tp, const String &in);
226  Bool giveMe(MRadialVelocity::Ref &mr, const String &in);
227  // </group>
228  // Set the offset in the reference (False if non-matching Measure)
229  virtual Bool setOffset(const Measure &in);
230  // Set the reference type to the specified String. False if illegal
231  // string, reference set to DEFAULT.
232  virtual Bool setRefString(const String &in);
233  // Get the default reference type
234  virtual const String &getDefaultType() const;
235  // Get a list of all known reference codes. nall returns the number in list,
236  // nextra the number of specials (like planets) that should be at
237  // end of list). typ returns the list of corresponding types.
238  // <group>
239  virtual const String* allTypes(Int &nall, Int &nextra,
240  const uInt *&typ) const;
241  static const String* allMyTypes(Int &nall, Int &nextra,
242  const uInt *&typ);
243  // </group>
244  // Check if all internal tables of types (both enum and String) are
245  // complete and correct. This function is called automatically if and when
246  // necessary.
247  // <thrown>
248  // <li> AipsError if a (programming) error in the types.
249  // </thrown>
250  // <group>
251  virtual void checkTypes() const;
252  static void checkMyTypes();
253  // </group>
254  // Get the reference type (for records, including codes like R_)
255  virtual String getRefString() const;
256  // Get my type (as Register)
257  static uInt myType();
258 
259  // Get radial velocity in specified units
260  Quantity get(const Unit &un) const;
261 
262  // Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
263  // <group>
265  // Local use only
266  static MDoppler toDoppler(const Measure &in);
267  // </group>
268 
269  // Make a RadialVelocity from the Doppler velocity (assuming LSRK default)
270  // <group>
271  static MRadialVelocity fromDoppler(const MDoppler &dop);
272  static MRadialVelocity fromDoppler(const MDoppler &dop,
274  // For internal use only
275  static MRadialVelocity fromDoppler(const Measure &dop,
277  // </group>
278 
279  // Make a copy
280  // <group>
281  virtual Measure *clone() const;
282  // </group>
283 
284  private:
285  //# Enumerations
286 
287  //# Data
288 
289  //# Member functions
290 
291 };
292 
293 
294 } //# NAMESPACE CASACORE - END
295 
296 #endif
int Int
Definition: aipstype.h:50
typedef WHATEVER_SUN_TYPEDEF(MRadialVelocity) Types Types
Reference enum Types (included originally for gcc 2.95)
Conversion of Measures.
Definition: MBaseline.h:44
static Bool getType(MRadialVelocity::Types &tp, const String &in)
Translate string to reference code.
static const String & showType(MRadialVelocity::Types tp)
MDoppler toDoppler()
Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
A Measure: Doppler shift.
Definition: MDoppler.h:134
MeasConvert< MRadialVelocity > Convert
Measure conversion use (i.e.
MCRadialVelocity MCType
Measure conversion routines for this class (i.e.
Physical quantities within reference frame.
Definition: Measure.h:235
A Measure: radial velocity.
ArrayMeasColumn< MRadialVelocity > ArrayColumn
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
Base class for all measures.
Definition: MeasBase.h:75
Bool giveMe(MRadialVelocity::Ref &mr, const String &in)
MVRadialVelocity MVType
Measure value container for this class (i.e.
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
defines physical units
Definition: Unit.h:189
Internal value for MRadialVelocity.
virtual Measure * clone() const
Make a copy.
static uInt myType()
Get my type (as Register)
virtual const String & tellMe() const
Tell me your type.
Base class for values in a Measure.
Definition: MeasValue.h:107
virtual const String & getDefaultType() const
Get the default reference type.
MRadialVelocity()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
static void checkMyTypes()
MRadialVelocity conversion routines.
static MRadialVelocity fromDoppler(const MDoppler &dop)
Make a RadialVelocity from the Doppler velocity (assuming LSRK default)
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
MeasRef< MRadialVelocity > Ref
Measure reference (i.e.
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
Types
Each derived class should have a Types enumeration, specifying the recognised frame types...
Definition: Measure.h:254
static void assure(const Measure &in)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ScalarMeasColumn< MRadialVelocity > ScalarColumn
Measure table Columns (e.g., MRadialVelocity::ScalarColumn)
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
static const String & showMe()
static MRadialVelocity::Types castType(uInt tp)
Translate reference code.
unsigned int uInt
Definition: aipstype.h:51