MFrequency.h

Classes

MFrequency -- A Measure: wave characteristics (full description)

class MFrequency : public MeasBase<MVFrequency, MeasRef<MFrequency> >

Types

enum 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

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Tests:

Prerequisite

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: The different reference types of a frequency are:

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:


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.
Caution 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

enum Types

Types of known MFrequencies

Warning 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().

typedef WHATEVER_SUN_TYPEDEF(MFrequency) Types Types

Reference enum Types (included originally for gcc 2.95)

MFrequency()

Tip 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

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)

Create from data and reference

virtual ~MFrequency()

virtual const String &tellMe() const
static const String &showMe()
virtual uInt type() const
static void assure(const Measure &in)

Tell me your type

static MFrequency::Types castType(uInt tp)
static const String &showType(MFrequency::Types tp)
static const String &showType(uInt tp)

Translate reference code. The uInt version has a check for valid codes (i.e. it is a safe cast).

Thrown Exceptions

static Bool getType(MFrequency::Types &tp, const String &in)
Bool giveMe(MFrequency::Ref &mr, const String &in)

Translate string to reference code

virtual Bool setOffset(const Measure &in)

Set the offset in the reference (False if non-matching Measure)

virtual Bool setRefString(const String &in)

Set the reference type to the specified String. False if illegal string, reference set to DEFAULT.

virtual const String &getDefaultType() const

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.

virtual void checkTypes() const
static void checkMyTypes()

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

virtual String getRefString() const

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

MDoppler toDoppler(const MVFrequency &rest)
MDoppler toDoppler(const MVFrequency &rest) const

Make a Doppler velocity from the frequency and the specified rest frequency

static MDoppler toDoppler(const Measure &in, const MVFrequency &rest)

Local use only

static MFrequency fromDoppler(const Measure &dop, const MVFrequency &rest, MFrequency::Types type)

Make a frequency from the Doppler velocity and the specified rest frequency (default reference type LSRK)

For internal use only

static MFrequency fromDoppler(const MDoppler &dop, const MVFrequency &rest)
static MFrequency fromDoppler(const MDoppler &dop, const MVFrequency &rest, MFrequency::Types type)

Make a frequency from the Doppler velocity and the specified rest frequency (default reference type LSRK)

MFrequency toRest(const MDoppler &dop)

Make a rest frequency using a Doppler velocity

static MFrequency toRest(const Measure &in, const Measure &dop)

For local use only

virtual Measure *clone() const

Make a copy