MDoppler.h

Classes

MDoppler -- A Measure: Doppler shift (full description)

class MDoppler : public MeasBase<MVDoppler, MeasRef<MDoppler> >

Types

enum Types

RADIO
Z
RATIO
BETA
GAMMA
N_Types
OPTICAL = Z,RELATIVISTIC=BETA,

Interface

Public Members
typedef WHATEVER_SUN_TYPEDEF(MDoppler) Types Types
MDoppler()
MDoppler(const MVDoppler &dt)
MDoppler(const MVDoppler &dt, const MDoppler::Ref &rf)
MDoppler(const MVDoppler &dt, MDoppler::Types rf)
MDoppler(const Quantity &dt)
MDoppler(const Quantity &dt, const MDoppler::Ref &rf)
MDoppler(const Quantity &dt, MDoppler::Types rf)
MDoppler(const Measure *dt)
MDoppler(const MeasValue *dt)
virtual ~MDoppler()
virtual const String &tellMe() const
static const String &showMe()
virtual uInt type() const
static void assure(const Measure &in)
static MDoppler::Types castType(uInt tp)
static const String &showType(MDoppler::Types tp)
static const String &showType(uInt tp)
static Bool getType(MDoppler::Types &tp, const String &in)
Bool giveMe(MDoppler::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
Vector<Double> shiftFrequency(const Vector<Double> &freq) const
Quantum<Vector<Double> > shiftFrequency(const Quantum<Vector<Double> > &freq) const
virtual Measure *clone() const

Description

Review Status

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

Prerequisite

Etymology

From Measure and Doppler

Synopsis

MDoppler forms the derived Measure class for Doppler shifts.
An MDoppler can be generated from a simple value (or an MVDoppler), which is then interpreted as a Doppler ratio, and a reference, with a RADIO type as default.
It can also be generated from a Quantity, where the interpretation depends on the dimensionality of the Quantity: The different types of Doppler (with F = f/f0, the frequency ratio), are: Note that the ones with an '*' have no real interpretation (although the calculation will proceed) if given as a velocity.

Conversion between the different types is done with the standard MeasConvert class (MDoppler::Convert in this case).

Dopplers can be created from an MFrequency object, or from an MRadialVelocity object.

A shiftFrequency() method can shift frequencies.

Dopplers do not need a reference frame.

Example

Conversion of a radio Doppler to an optical
	MDoppler radio(0.01);		// A radio Doppler value
	cout << "Doppler radio = " << radio << "; optical = " <<
		MDoppler::Convert(radio, MDoppler::OPTICAL)() << // Convert 
		endl;
Setting up a conversion
	MDoppler::Convert to_opt(MDoppler::RADIO, MDoppler::OPTICAL);
	for (Double d=0; d<0.1; d += 0.005) {
		cout << "radio = " << d << " to optical = " <<
			to_opt(d) << endl;

Motivation

To Do

Member Description

enum Types

Types of known MDopplers

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(MDoppler) Types Types

Reference enum Types (included originally for gcc 2.95)

MDoppler()

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 Doppler

MDoppler(const MVDoppler &dt)
MDoppler(const MVDoppler &dt, const MDoppler::Ref &rf)
MDoppler(const MVDoppler &dt, MDoppler::Types rf)
MDoppler(const Quantity &dt)
MDoppler(const Quantity &dt, const MDoppler::Ref &rf)
MDoppler(const Quantity &dt, MDoppler::Types rf)
MDoppler(const Measure *dt)
MDoppler(const MeasValue *dt)

Create from data and reference

virtual ~MDoppler()

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

Tell me your type

static MDoppler::Types castType(uInt tp)
static const String &showType(MDoppler::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(MDoppler::Types &tp, const String &in)
Bool giveMe(MDoppler::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 in specified units

Vector<Double> shiftFrequency(const Vector<Double> &freq) const
Quantum<Vector<Double> > shiftFrequency(const Quantum<Vector<Double> > &freq) const

Shift the input frequencies to the output frequencies. In the case of simple Double inputs, it is assumed that the values are linearly dependent on frequency. I.e. frequencies given as wavelength or time cannot be used.

virtual Measure *clone() const

Make a copy