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