casacore
Loading...
Searching...
No Matches
casacore::MFrequency Class Reference

More...

#include <MFrequency.h>

Public Types

enum  Types {
  REST ,
  LSRK ,
  LSRD ,
  BARY ,
  GEO ,
  TOPO ,
  GALACTO ,
  LGROUP ,
  CMB ,
  N_Types ,
  Undefined ,
  N_Other ,
  EXTRA ,
  DEFAULT ,
  LSR
}
 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();
. More...
typedef MVFrequency MVType
 Measure value container for this class (i.e.
typedef MCFrequency MCType
 Measure conversion routines for this class (i.e.
typedef MeasRef< MFrequencyRef
 Measure reference (i.e.
typedef MeasConvert< MFrequencyConvert
 Measure conversion use (i.e.
typedef ScalarMeasColumn< MFrequencyScalarColumn
 Measure table Columns (e.g., MFrequency::ScalarColumn).
typedef ArrayMeasColumn< MFrequencyArrayColumn
Public Types inherited from casacore::Measure
enum  Types {
  N_Types ,
  DEFAULT
}
 Each derived class should have a Types enumeration, specifying the recognised frame types. More...
typedef void * Convert
 Each Measure should have typedefs of the form:

Public Member Functions

 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)
 Create from data and reference.
 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 StringtellMe () const
 Tell me your type.
Bool giveMe (MFrequency::Ref &mr, const String &in)
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.
virtual const StringgetDefaultType () const
 Get the default reference type.
virtual const StringallTypes (Int &nall, Int &nextra, const uInt *&typ) const
 Get a list of all known reference codes.
virtual void checkTypes () const
 Check if all internal tables of types (both enum and String) are complete and correct.
virtual String getRefString () const
 Get the reference type (for records, including codes like R_).
Quantity get (const Unit &un) const
 Get frequency in specified units.
MDoppler toDoppler (const MVFrequency &rest)
 Make a Doppler velocity from the frequency and the specified rest frequency.
MDoppler toDoppler (const MVFrequency &rest) const
MFrequency toRest (const MDoppler &dop) const
 Make a rest frequency using a Doppler velocity.
virtual Measureclone () const
 Make a copy.
Public Member Functions inherited from casacore::MeasBase< MVFrequency, MeasRef< MFrequency > >
 MeasBase ()
 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; For reasons of compiler limitations the formal arguments had to be specified as uInt rather than the Measure enums that should be used as actual arguments;
Default constructor
MeasBase< MVFrequency, MeasRef< MFrequency > > & operator= (const MeasBase< MVFrequency, MeasRef< MFrequency > > &other)
 Copy assignment.
virtual ~MeasBase ()
virtual Bool areYou (const String &tp) const
 Check the type of derived entity.
virtual void assured (const String &tp) const
 Assert that we are the correct type.
void set (const MVFrequency &dt)
 Refill the specified entities.
virtual Bool putValue (const Vector< Quantum< Double > > &in)
MeasRef< MFrequencygetRef () const
 Get reference.
const MVFrequencygetValue () const
 Get Measure data.
const UnitgetUnit () const
 Get Unit.
virtual MRBasegetRefPtr () const
 Get reference pointer.
virtual const MeasValuegetData () const
 Get pointer to data.
virtual void print (std::ostream &os) const
 Print a Measure.
Public Member Functions inherited from casacore::Measure
virtual ~Measure ()
 Destructor.
virtual void set (const MeasValue &dt)=0
 Each Measure should have the following set functions (with appropiate MVs and Ref):
virtual Bool isModel () const
 Tell me if you are a pure model (e.g.
void dummy_giveMe () const
 Each derived class should have a string-to-code translation routine for the reference type.
void dummy_getRef () const
 Each class should have a function to return its reference:
void dummy_getValue () const
 Each derived class should be able to get its internal value and have:

Static Public Member Functions

static const StringshowMe ()
static void assure (const Measure &in)
static MFrequency::Types castType (uInt tp)
 Translate reference code.
static const StringshowType (MFrequency::Types tp)
static const StringshowType (uInt tp)
static Bool getType (MFrequency::Types &tp, const String &in)
 Translate string to reference code.
static MFrequency::Types typeFromString (const String &in)
 Throws an exception if the type string is not recognized.
static const StringallMyTypes (Int &nall, Int &nextra, const uInt *&typ)
static void checkMyTypes ()
static MDoppler toDoppler (const Measure &in, const MVFrequency &rest)
 Local use only.
static MFrequency fromDoppler (const MDoppler &dop, const MVFrequency &rest)
 Make a frequency from the Doppler velocity and the specified rest frequency (default reference type LSRK).
static MFrequency fromDoppler (const MDoppler &dop, const MVFrequency &rest, MFrequency::Types type)
static MFrequency fromDoppler (const Measure &dop, const MVFrequency &rest, MFrequency::Types type)
 For internal use only.
static MFrequency toRest (const Measure &in, const Measure &dop)
 For local use only.
Static Public Member Functions inherited from casacore::Measure
static uInt giveMe (const String &in, Int N_name, const String tname[])
 A general string checking routine to be used in derived measures.

Friends

class MeasConvert< MFrequency >
 Conversion of data.

Additional Inherited Members

Protected Attributes inherited from casacore::MeasBase< MVFrequency, MeasRef< MFrequency > >
MVFrequency data
 The measure value (e.g.
MeasRef< MFrequencyref
 Reference frame data.
Unit unit
 Possible input units.

Detailed Description

A Measure: wave characteristics

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tMeasure

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:

  • 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:

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


To accommodate unknown or invalid frames, the additional reference type

is available. Conversions to/from Undefined are not possible. If attempted, an exception will be thrown. The name was chosen to be Undefined and not UNDEFINED in order to not collide with the (ugly) WCSLIB macro of the upper case name and in concordance with Stokes::Undefined.
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::Z)() << endl;
MeasConvert< MDoppler > Convert
Measure Convert (i.e.
Definition MDoppler.h:165
MDoppler toDoppler(const MVFrequency &rest)
Make a Doppler velocity from the frequency and the specified rest frequency.
MFrequency()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measu...
static const Quantum< Double > & HI()
HI line.
Definition QC.h:186
Quantum< Double > Quantity
Definition Quantum.h:39

Motivation

Definition at line 158 of file MFrequency.h.

Member Typedef Documentation

◆ ArrayColumn

◆ Convert

Measure conversion use (i.e.

MFrequency::Convert)

Definition at line 201 of file MFrequency.h.

◆ MCType

Measure conversion routines for this class (i.e.

MFrequency::MCType)

Definition at line 197 of file MFrequency.h.

◆ MVType

Measure value container for this class (i.e.

MFrequency::MVType)

Definition at line 195 of file MFrequency.h.

◆ Ref

Measure reference (i.e.

MFrequency::Ref)

Definition at line 199 of file MFrequency.h.

◆ ScalarColumn

Member Enumeration Documentation

◆ 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();
.

Enumerator
REST 
LSRK 
LSRD 
BARY 
GEO 
TOPO 
GALACTO 
LGROUP 
CMB 
N_Types 
Undefined 
N_Other 
EXTRA 

all extra bits

DEFAULT 

Defaults.

LSR 

Synonyms.

Definition at line 173 of file MFrequency.h.

Constructor & Destructor Documentation

◆ MFrequency() [1/9]

casacore::MFrequency::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

Referenced by fromDoppler(), fromDoppler(), fromDoppler(), MeasConvert< MFrequency >, toRest(), and toRest().

◆ MFrequency() [2/9]

casacore::MFrequency::MFrequency ( const MVFrequency & dt)

Create from data and reference.

◆ MFrequency() [3/9]

casacore::MFrequency::MFrequency ( const MVFrequency & dt,
const MFrequency::Ref & rf )

◆ MFrequency() [4/9]

casacore::MFrequency::MFrequency ( const MVFrequency & dt,
MFrequency::Types rf )

◆ MFrequency() [5/9]

casacore::MFrequency::MFrequency ( const Quantity & dt)

◆ MFrequency() [6/9]

casacore::MFrequency::MFrequency ( const Quantity & dt,
const MFrequency::Ref & rf )

◆ MFrequency() [7/9]

casacore::MFrequency::MFrequency ( const Quantity & dt,
MFrequency::Types rf )

◆ MFrequency() [8/9]

casacore::MFrequency::MFrequency ( const Measure * dt)

◆ MFrequency() [9/9]

casacore::MFrequency::MFrequency ( const MeasValue * dt)

◆ ~MFrequency()

virtual casacore::MFrequency::~MFrequency ( )
virtual

Member Function Documentation

◆ allMyTypes()

const String * casacore::MFrequency::allMyTypes ( Int & nall,
Int & nextra,
const uInt *& typ )
static

◆ allTypes()

virtual const String * casacore::MFrequency::allTypes ( Int & nall,
Int & nextra,
const uInt *& typ ) const
virtual

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.

Reimplemented from casacore::Measure.

◆ assure()

void casacore::MFrequency::assure ( const Measure & in)
static

◆ castType()

MFrequency::Types casacore::MFrequency::castType ( uInt tp)
static

Translate reference code.

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

Thrown Exceptions

◆ checkMyTypes()

void casacore::MFrequency::checkMyTypes ( )
static

◆ checkTypes()

virtual void casacore::MFrequency::checkTypes ( ) const
virtual

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.

Implements casacore::Measure.

◆ clone()

virtual Measure * casacore::MFrequency::clone ( ) const
virtual

Make a copy.

Implements casacore::Measure.

◆ fromDoppler() [1/3]

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

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

References MFrequency().

◆ fromDoppler() [2/3]

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

References MFrequency().

◆ fromDoppler() [3/3]

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

For internal use only.

References MFrequency().

◆ get()

Quantity casacore::MFrequency::get ( const Unit & un) const

Get frequency in specified units.

◆ getDefaultType()

virtual const String & casacore::MFrequency::getDefaultType ( ) const
virtual

Get the default reference type.

Implements casacore::Measure.

◆ getRefString()

virtual String casacore::MFrequency::getRefString ( ) const
virtual

Get the reference type (for records, including codes like R_).

Implements casacore::Measure.

◆ getType()

Bool casacore::MFrequency::getType ( MFrequency::Types & tp,
const String & in )
static

Translate string to reference code.

◆ giveMe()

Bool casacore::MFrequency::giveMe ( MFrequency::Ref & mr,
const String & in )

◆ setOffset()

virtual Bool casacore::MFrequency::setOffset ( const Measure & in)
virtual

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

Implements casacore::Measure.

◆ setRefString()

virtual Bool casacore::MFrequency::setRefString ( const String & in)
virtual

Set the reference type to the specified String.

False if illegal string, reference set to DEFAULT.

Implements casacore::Measure.

◆ showMe()

const String & casacore::MFrequency::showMe ( )
static

◆ showType() [1/2]

const String & casacore::MFrequency::showType ( MFrequency::Types tp)
static

◆ showType() [2/2]

const String & casacore::MFrequency::showType ( uInt tp)
static

◆ tellMe()

virtual const String & casacore::MFrequency::tellMe ( ) const
virtual

Tell me your type.

Implements casacore::Measure.

◆ toDoppler() [1/3]

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

Local use only.

◆ toDoppler() [2/3]

MDoppler casacore::MFrequency::toDoppler ( const MVFrequency & rest)

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

◆ toDoppler() [3/3]

MDoppler casacore::MFrequency::toDoppler ( const MVFrequency & rest) const

◆ toRest() [1/2]

MFrequency casacore::MFrequency::toRest ( const MDoppler & dop) const

Make a rest frequency using a Doppler velocity.

References MFrequency().

◆ toRest() [2/2]

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

For local use only.

References MFrequency().

◆ typeFromString()

MFrequency::Types casacore::MFrequency::typeFromString ( const String & in)
static

Throws an exception if the type string is not recognized.

◆ MeasConvert< MFrequency >

friend class MeasConvert< MFrequency >
friend

Conversion of data.

Definition at line 1 of file MFrequency.h.

References MFrequency().


The documentation for this class was generated from the following file: