casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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 
180  //# Constructors
181  // <note role=tip> In the following constructors and other functions, all
182  // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
183  // where no offsets or frames are needed in the reference. </note>
184  // Default constructor; generates a zero rest RadialVelocity
185  MRadialVelocity();
186  // Create from data and reference
187  // <group>
191  MRadialVelocity(const Quantity &dt);
192  MRadialVelocity(const Quantity &dt, const MRadialVelocity::Ref &rf);
194  MRadialVelocity(const Measure *dt);
195  MRadialVelocity(const MeasValue *dt);
196  // </group>
197 
198  //# Destructor
199  virtual ~MRadialVelocity();
200 
201  //# Operators
202 
203  //# General Member Functions
204  // Tell me your type
205  // <group>
206  virtual const String &tellMe() const;
207  static const String &showMe();
208  virtual uInt type() const;
209  static void assure(const Measure &in);
210  // </group>
211  // Translate reference code. The uInt version has a check for valid codes
212  // (i.e. it is a safe cast).
213  // <thrown>
214  // <li> AipsError in the uInt interface if illegal code given
215  // </thrown>
216  // <group>
218  static const String &showType(MRadialVelocity::Types tp);
219  static const String &showType(uInt tp);
220  // </group>
221  // Translate string to reference code
222  // <group>
223  static Bool getType(MRadialVelocity::Types &tp, const String &in);
224  Bool giveMe(MRadialVelocity::Ref &mr, const String &in);
225  // </group>
226  // Set the offset in the reference (False if non-matching Measure)
227  virtual Bool setOffset(const Measure &in);
228  // Set the reference type to the specified String. False if illegal
229  // string, reference set to DEFAULT.
230  virtual Bool setRefString(const String &in);
231  // Get the default reference type
232  virtual const String &getDefaultType() const;
233  // Get a list of all known reference codes. nall returns the number in list,
234  // nextra the number of specials (like planets) that should be at
235  // end of list). typ returns the list of corresponding types.
236  // <group>
237  virtual const String* allTypes(Int &nall, Int &nextra,
238  const uInt *&typ) const;
239  static const String* allMyTypes(Int &nall, Int &nextra,
240  const uInt *&typ);
241  // </group>
242  // Check if all internal tables of types (both enum and String) are
243  // complete and correct. This function is called automatically if and when
244  // necessary.
245  // <thrown>
246  // <li> AipsError if a (programming) error in the types.
247  // </thrown>
248  // <group>
249  virtual void checkTypes() const;
250  static void checkMyTypes();
251  // </group>
252  // Get the reference type (for records, including codes like R_)
253  virtual String getRefString() const;
254  // Get my type (as Register)
255  static uInt myType();
256 
257  // Get radial velocity in specified units
258  Quantity get(const Unit &un) const;
259 
260  // Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
261  // <group>
263  // Local use only
264  static MDoppler toDoppler(const Measure &in);
265  // </group>
266 
267  // Make a RadialVelocity from the Doppler velocity (assuming LSRK default)
268  // <group>
269  static MRadialVelocity fromDoppler(const MDoppler &dop);
270  static MRadialVelocity fromDoppler(const MDoppler &dop,
272  // For internal use only
273  static MRadialVelocity fromDoppler(const Measure &dop,
275  // </group>
276 
277  // Make a copy
278  // <group>
279  virtual Measure *clone() const;
280  // </group>
281 
282  private:
283  //# Enumerations
284 
285  //# Data
286 
287  //# Member functions
288 
289 };
290 
291 
292 } //# NAMESPACE CASACORE - END
293 
294 #endif
int Int
Definition: aipstype.h:50
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
Conversion of Measures.
Definition: MDirection.h:43
static Bool getType(MRadialVelocity::Types &tp, const String &in)
Translate string to reference code.
static const String & showType(MRadialVelocity::Types tp)
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
virtual const String & getDefaultType() const
Get the default reference type.
MDoppler toDoppler()
Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
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 const String & tellMe() const
Tell me your type.
defines physical units
Definition: Unit.h:189
Internal value for MRadialVelocity.
static uInt myType()
Get my type (as Register)
Base class for values in a Measure.
Definition: MeasValue.h:107
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
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
MeasRef< MRadialVelocity > Ref
Measure reference (i.e.
virtual Measure * clone() const
Make a copy.
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 const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
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
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42