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: 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
38namespace casacore { //# NAMESPACE CASACORE - BEGIN
39
40//# Forward Declarations
41class MRadialVelocity;
43template <class M> class MeasConvert;
44template <class M> class ArrayMeasColumn;
45template <class M> class ScalarMeasColumn;
46class MDoppler;
47class 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
137class MRadialVelocity : public MeasBase<MVRadialVelocity, MeasRef<MRadialVelocity> > {
138
139 public:
140 //# Friends
141 // Conversion of data
142 friend class MeasConvert<MRadialVelocity>;
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>
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
186 // Create from data and reference
187 // <group>
196 // </group>
197
198 //# Destructor
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 static void assure(const Measure &in);
209 // </group>
210 // Translate reference code. The uInt version has a check for valid codes
211 // (i.e. it is a safe cast).
212 // <thrown>
213 // <li> AipsError in the uInt interface if illegal code given
214 // </thrown>
215 // <group>
218 static const String &showType(uInt tp);
219 // </group>
220 // Translate string to reference code
221 // <group>
224 // </group>
225 // Set the offset in the reference (False if non-matching Measure)
226 virtual Bool setOffset(const Measure &in);
227 // Set the reference type to the specified String. False if illegal
228 // string, reference set to DEFAULT.
229 virtual Bool setRefString(const String &in);
230 // Get the default reference type
231 virtual const String &getDefaultType() const;
232 // Get a list of all known reference codes. nall returns the number in list,
233 // nextra the number of specials (like planets) that should be at
234 // end of list). typ returns the list of corresponding types.
235 // <group>
236 virtual const String* allTypes(Int &nall, Int &nextra,
237 const uInt *&typ) const;
238 static const String* allMyTypes(Int &nall, Int &nextra,
239 const uInt *&typ);
240 // </group>
241 // Check if all internal tables of types (both enum and String) are
242 // complete and correct. This function is called automatically if and when
243 // necessary.
244 // <thrown>
245 // <li> AipsError if a (programming) error in the types.
246 // </thrown>
247 // <group>
248 virtual void checkTypes() const;
249 static void checkMyTypes();
250 // </group>
251 // Get the reference type (for records, including codes like R_)
252 virtual String getRefString() const;
253
254 // Get radial velocity in specified units
255 Quantity get(const Unit &un) const;
256
257 // Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
258 // <group>
260 // Local use only
261 static MDoppler toDoppler(const Measure &in);
262 // </group>
263
264 // Make a RadialVelocity from the Doppler velocity (assuming LSRK default)
265 // <group>
269 // For internal use only
272 // </group>
273
274 // Make a copy
275 // <group>
276 virtual Measure *clone() const;
277 // </group>
278
279 private:
280 //# Enumerations
281
282 //# Data
283
284 //# Member functions
285
286};
287
288
289} //# NAMESPACE CASACORE - END
290
291#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:225
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:51
int Int
Definition aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:42