MFrequency.h
Classes
- MFrequency -- A Measure: wave characteristics (full description)
class MFrequency : public MeasBase<MVFrequency, MeasRef<MFrequency> >
Types
- REST
-
- LSRK
-
- LSRD
-
- BARY
-
- GEO
-
- TOPO
-
- GALACTO
-
- LGROUP
-
- CMB
-
- N_Types
-
- DEFAULT = LSRK,
-
Defaults
Interface
- Public Members
- typedef WHATEVER_SUN_TYPEDEF(MFrequency) Types Types
- MFrequency()
- MFrequency(const MVFrequency &dt)
- MFrequency(const MVFrequency &dt, const MFrequency::Ref &rf)
- MFrequency(const MVFrequency &dt, MFrequency::Types rf)
- MFrequency(const Quantity &dt)
- MFrequency(const Quantity &dt, const MFrequency::Ref &rf)
- MFrequency(const Quantity &dt, MFrequency::Types rf)
- MFrequency(const Measure *dt)
- MFrequency(const MeasValue *dt)
- virtual ~MFrequency()
- virtual const String &tellMe() const
- static const String &showMe()
- virtual uInt type() const
- static void assure(const Measure &in)
- static MFrequency::Types castType(uInt tp)
- static const String &showType(MFrequency::Types tp)
- static const String &showType(uInt tp)
- static Bool getType(MFrequency::Types &tp, const String &in)
- Bool giveMe(MFrequency::Ref &mr, const String &in)
- virtual Bool setOffset(const Measure &in)
- virtual Bool setRefString(const String &in)
- virtual const String &getDefaultType() const
- virtual const String *const allTypes(Int &nall, Int &nextra, const uInt *&typ) const
- static const String *const allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
- virtual void checkTypes() const
- static void checkMyTypes()
- virtual String getRefString() const
- static uInt myType()
- Quantity get(const Unit &un) const
- MDoppler toDoppler(const MVFrequency &rest)
- MDoppler toDoppler(const MVFrequency &rest) const
- static MDoppler toDoppler(const Measure &in, const MVFrequency &rest)
- static MFrequency fromDoppler(const MDoppler &dop, const MVFrequency &rest)
- static MFrequency fromDoppler(const MDoppler &dop, const MVFrequency &rest, MFrequency::Types type)
- static MFrequency fromDoppler(const Measure &dop, const MVFrequency &rest, MFrequency::Types type)
- MFrequency toRest(const MDoppler &dop)
- static MFrequency toRest(const Measure &in, const Measure &dop)
- virtual Measure *clone() const
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
- Programs:
- Tests:
Prerequisite
- Measure class
- MRadialVelocity class
for some other background.
Etymology
Synopsis
MFrequency is a derived Measure class for wave characteristics.
An MFrequency can be generated from a simple value (or an
MFrequency object), which is then
interpreted as a frequency in Hz, and a reference, with an LSRK type
as default.
It can also be generated from a Quantity, where the interpretation
depends on the dimensionality of the Quantity:
time (e.g. s): period
frequency (e.g. Hz): frequency
angular frequency (e.g. arcmin/s): angular frequency
length (e.g. cm): wavelength
inverse length (e.g. mm-1): wave number
energy (e.g. J.s): energy (i.e. h.nu)
momentum (e.g. kg.m): m.c/h
The different reference types of a frequency are:
- MFrequency::REST -- Rest frequency
- MFrequency::LSRD -- Local Standard of Rest (J2000) -- as the
dynamical definition (IAU, [9,12,7] km/s in galactic
coordinates)
- MFrequency::LSRK -- LSR as a kinematical (radio) definition --
20.0 km/s in direction ra,dec = [270,+30] deg (B1900.0)
- MFrequency::BARY -- Barycentric (J2000)
- MFrequency::GEO --- Geocentric
- MFrequency::TOPO -- Topocentric
- MFrequency::GALACTO -- Galacto centric (with rotation of 220 km/s
in direction l,b = [90,0] deg.
- MFrequency::LGROUP -- Local group velocity -- 308km/s towards
l,b = [105,-7] deg (F. Ghigo)
- MFrequency::CMB -- CMB velocity -- 369.5km/s towards
l,b = [264.4, 48.4] deg (F. Ghigo)
- MFrequency::DEFAULT = LSRK
Conversion between the different types is done with the standard
MeasConvert class
(MFrequency::Convert in this case).
Some of the conversions are only possible if frame information has been
filled in. The following frame information is necessary if a conversion
goes to or from the (different) specified types:
- Radial Velocity: REST
- Epoch: TOPO, GEO
- Position: TOPO
- Direction all
An MFrequency can be created from an
MDoppler (and a rest frequency, (the
QC class contains at least QC::HI))
by the fromDoppler() member. It can be converted to an MDoppler
with the toDoppler(). Comparable methods will be available
for MFrequency as
toRadial() and fromRadial.
If the Doppler shift is known (e.g. from another spectral line), the
REST frequency can be determined with the toREST() member.
Conversion between the different frequencies can,
due to relativistic effects, only be done approximately for very high
(order c) radial velocities (shifted frequencies). A better approach
would be to start from radial velocities and a rest frequency.
Example
Get the Doppler shift for an oberved HI frequency of 1380 MHz
cout << "Redshift for 1380 MHz: " <<
MDoppler::Convert( MFrequency( Quantity(1380., "MHz"),
MFrequency::TOPO).toDoppler(QC::HI),
MDoppler::Z)() << endl;
Motivation
To Do
Member Description
Types of known MFrequencies
The order defines the order in the translation
matrix FromTo
in the getConvert routine. Do not change the order without
changing the array. Additions should be made before N_types, and
an additional row and column should be coded in FromTo, and
in showType().
Reference enum Types (included originally for gcc 2.95)
In the following constructors and other functions, all
MeasRef can be replaced with simple Measure::TYPE
where no offsets or frames are needed in the reference.
Default constructor; generates a zero rest frequency
Create from data and reference
virtual const String &tellMe() const
static const String &showMe()
virtual uInt type() const
static void assure(const Measure &in)
Tell me your type
Translate reference code. The uInt version has a check for valid codes
(i.e. it is a safe cast).
Thrown Exceptions
- AipsError in the uInt interface if illegal code given
static Bool getType(MFrequency::Types &tp, const String &in)
Bool giveMe(MFrequency::Ref &mr, const String &in)
Translate string to reference code
Set the offset in the reference (False if non-matching Measure)
Set the reference type to the specified String. False if illegal
string, reference set to DEFAULT.
Get the default reference type
virtual const String *const allTypes(Int &nall, Int &nextra, const uInt *&typ) const
static const String *const allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
Get a list of all known reference codes. nall returns the number in list,
nextra the number of specials (like planets) that should be at
end of list). typ returns the list of corresponding types.
Check if all internal tables of types (both enum and String) are
complete and correct. This function is called automatically if and when
necessary.
Thrown Exceptions
- AipsError if a (programming) error in the types.
Get the reference type (for records, including codes like R_)
static uInt myType()
Get my type (as Register)
Quantity get(const Unit &un) const
Get frequency in specified units
Make a Doppler velocity from the frequency and the specified rest frequency
Local use only
Make a frequency from the Doppler velocity and the specified rest frequency
(default reference type LSRK)
For internal use only
Make a frequency from the Doppler velocity and the specified rest frequency
(default reference type LSRK)
Make a rest frequency using a Doppler velocity
static MFrequency toRest(const Measure &in, const Measure &dop)
For local use only
Make a copy