This guide gives a short overview of the background and use of the Measures module in C++. Detailed information can be found in the
Measures module description, and in the individual header files of the classes in this module.
Section 2 explains what a Measure consists of, and why; section 3 discusses conversion; section 4 some notes on efficient use and section 5 gives the common interface of Measures and their values. Appendices give some details per Measure.
Currently the following measures exist:
A specific Measure class is indicated with an , e.g. a direction measure is an .
A Measure consists of a value and a reference. The value of a Measure is a vector of double floating point numbers, in some internal format, independent of the units used to create them. The value is called a MeasValue, and specific ones are indicated with the letters , e.g. 1. Appendix A gives the various internal values.
A value can be constructed in many different ways. An can, e.g. be constructed from 2 angles or from 3 direction cosines; an from a wavelength or the wave energy.
Some Measures can often also be obtained from a catalog, especially a list of
observatories, a source list and a spectral line list. They can be obtained as:
The reference consists of up to 3 fields:
In some cases the code has all the available information to be able to interpret the value (like the MDirection::J2000). In other cases the information is not sufficient. An example is the MDirection::AZEL. If you have measured some AZEL values, and are only interested in say a pointing model for the telescope, the MDirection::AZEL is sufficient information. However, if you want to convert the measured AZEL into a J2000 right ascension and declination, it is necessary to know where your telescope is, and what the epoch of the observation is. This can be specified in
A reference is created as a specialized MeasRef object, using the
Measure::Ref alias (e.g. MDirection::Ref). A full reference could be:
Measures can be converted from one reference into another reference. E.g. from an MDirection::J2000 direction coordinate into an MDirection::AZEL coordinate; or from an MEpoch::UTC into an MEpoch::TAI. Conversion objects are MeasConvert objects, using the Measure::Convert alias (e.g. MDirection::Convert. The conversion object needs at least a from reference and a to reference.
Example:
Note that if a frame is necessary, it suffices to give it with either one of the two references. Unless, of course, they are different for the two references, like converting the AZEL at one telescope to that at another. The latter case (i.e. two different reference frames for the input and output values), is handled by always converting first the input value to the default for the class (e.g. J2000 for directions), and then convert this value to the appropriate output type and frame.
The from reference can also be specified as a complete Measure. In that case that value of the Measure will act as the default value to be converted.
Constructing a conversion object will set up a series of conversions that have to be done to get from the from to the to reference. This state-machine like approach is to be able to use less than the required odd 400 conversion routines for say 20 different allowable reference codes.
The conversion object is executed with the () operator. The actual conversion done depends on the argument of the operator:
If the conversion needs information, it will cache anything it calculates, either in the conversion object (like calculated Nutation), or in the frame (like e.g. the sidereal time of a frame MEpoch specified in UTC). This information will be re-used if possible and feasible in subsequent conversions with the same conversion object or using the same frame.
It is also worth noting that frames are handled internally by reference rather than by value (e.g. when copied) (the same is true for Measure::Ref objects). One consequence is that a conversion knows about any change you make to a frame, and will use it. So, if by a frame.set(MEpoch) the time of a frame is changed, a subsequent conversion which had that frame given as the frame to be used, will automatically use the new time.
The efficiency of the use of the Measures and related classes can vary greatly. By using the appropriate interface, by fine-tuning with the aid of aipsrc variables, and by making sure the caching system is used optimally, there can be a large reduction in resource use.
It is not always necessary to use a full-fledged Measure. It often suffices to use a MeasValue (or maybe even a Quantity or just a simple Double.
As an example, consider a frequency container object:
As a rule of thumb the above could be summarised as:
Similar arguments can be used for the other Measures.
From the point of view of the programmer, a frame is just a container of Measures to indicate when, where, in what direction and at what frequency a certain Measure was made or referred to. However, in actual fact it is also an engine and cache for a lot of calculations. Imagine that you want to convert from right-ascension and declination to hour-angle and declination, and that you have provided an epoch in in the frame. The actual conversion object will request (probably among other things), the sidereal time from the frame. The first request will set up a conversion object within the frame (from to ) and cache it for later use. After that it will use this conversion object to obtain the sidereal time, and cache the result (for maybe a subsequent call). The conversion needs nutation, polar motion and a few other calculations. Again, all of these are cached for subsequent use in other calls to the frame for information.
Efficient use of Measures is only possible if the lifetime of a frame is as long as possible. Which suggests that in many cases a frame should be created at the highest level possible (maybe even globally). Re-use of a frame, e.g. for a different time, is made possible by the set() methods, e.g. , which will try to minimize the re-calculations necessary. The fact that frames are always used internally by reference (see earlier), which also means that any change made to a frame will automatically be used by any subsequent conversion which knows about this frame, makes in principle for an efficient machinery for many different purposes. However, it could also easily lead to misunderstandings. If you plan to do any special conversions, the detailed information provided in the various Measure classes should be perused.
Similar to the frame discussed in the previous section, a conversion object (e.g. MDirection::Convert) is a repository of the necessary state-machine to make the conversion possible, and any intermediate calculation results. To make efficient use of this information, the same conversion object should be used if more than one conversion of the same type has to be done.
Although the official MeasConvert objects are very versatile, using them can be quite a job. For that reason a set of specialized “Conversion engines” have been put together for easy use. The three engines available at the moment are described in the following paragraphs. They have all a basic format:
The EarthMagneticMachine calculates the Earth’ magnetic field in a certain direction at a certain height above the Earth’ surface.
The machine object’s constructor needs in principle:
The operator will produce the line-of-sight component of the magnetic field (see the header files for details). Other methods exist to get the complete magnetic field; the longitude of the point specified and the position on Earth of the point. The following example calculates the magnetic field at 200 height at the Compact Array:
The velocity machine converts between frequencies and velocities (or ). This machine has been developed to aid in the, especially for the beginning user of Measures, intricate way RadialVelocity, Doppler and Frequency are connected. The machine converts between and values.
The constructor of the machine needs:
The operator has an MVFrequency, an MVDoppler or a Quantity as argument. Depending on if it is a velocity or a frequency, the argument is converted to the other representation. makeFrequency and makeVelocity exist to create a vector of velocities or frequencies from a vector of Doubles.
An example:
The UVWMachine can convert -coordinates between coordinate systems. In addition it can provide the phase rotation necessary on the data to have a new fringe-stopping center. A simple conversion of coordinates will be executed if only the coordinate reference frame is changed (e.g. from a to a or an coordinate system). If also the actual position on the sky is changed, the phase rotation necessary on the data is provided as well. Fringe stopping centers can be centered on other bodies as well (e.g. a planet). Read the caveats in the detailed help file.
The constructor of the machine needs the following input:
The output of the machine can be one or all of the following:
Example:
The precision of a Measure conversion can be influenced by the use of aipsrc variables. Changing the precision will influence the efficiency of the Measures conversion.
Parameters that can be used are, a.o., the length of periods over which computations can be re-used; if it is necessary to use tables for precise calculation of time and polar motion, or that the simple model suffices.
A few examples:
Name | Description | Default |
measures.nutation.d_interval | interval in days over which linear interpolation of nutation calculation is appropriate | 0.04d |
measures.nutation.b_useiers | use the IERS Earth orientation parameters tables to calculate nutation | false |
measures.nutation.b_usejpl | use the JPL DE database (use measures.jpl.ephemeris to specify which one) to calculate nutation | false |
measures.measiers.b_notable | do not use the IERSeop97 or IERSpredict tables at all for calculations | false |
The interface to the different Measures have a large set of identical methods. Only when values are clearly related to a specific Measure (like e.g. a latitude) does the method to obtain not exist for e.g. a frequency. Constructors of Measures have often specializations (like one with a longitude and latitude for a direction), but they all have also standard ones. The standard ones are described in the
The various value that are contained in the Measure object can be obtained by the following calls:
General calls are available to obtain the information contained in the Measure::Ref object:
set() methods are available to fill in the fields in the Measure::Ref object.
Each MeasValue has methods to obtain the internal data in a standard way. Some have additional ones available when appropriate (like getLong()):
The frame can be used as an automatic converter. An example could
be the automatic conversion to a sidereal time from a civil time (like
). All
conversions that are used internally by the various conversion engines are
available. Of course, the epoch should have been put into the frame for it to be
converted; and in this case also the position should have been put into it.
Available information from the frame:
In the above reference is made to the calculating state of the frame. This state is set when the frame has been actively used by a Measure::Convert engine (i.e. have at least one operator() executed); or if you do it explicitly with: MCFrame::make(frame);.
More information on the different astronomical conventions and data can be
found in:
Time, Coordinates
Positions
Frequency, Doppler, Velocity
Magnetic field
Baseline, uvw
In the following some comments are made per Measure type. A list is given of the known reference codes, and the frame information necessary to convert from/to each code is indicated.
An epoch in time. Internally maintained as an absolute time as a Modified Julian
Day (or a Greenwich Sidereal Date) in two Double numbers. Formatting of an
MEpoch (or any time expressed in time or angle units) can be done with the
MVTime class.
MEpoch
| ||
Code | Description | Frame info
|
LAST | Local Apparent Sidereal Time | MPosition |
LMST | Local Mean Sidereal Time | MPosition |
GMST1 | Greenwich Mean ST1 | |
GAST | Greenwich Apparent ST |
|
UT1 |
|
|
UT2 |
| |
UTC |
|
|
TAI |
| |
TDT |
|
|
TCG |
|
|
TDB |
|
|
TCB |
|
|
IAT |
|
|
GMST | MPosition |
|
TT |
|
|
UT |
|
|
ET |
|
|
DEFAULT |
|
|
A special code modifier MEpoch::RAZE exist. Its result is that after a conversion to a code with the RAZE bit set, the result will be truncated to integer days. Useful to find a sidereal time offset for a specific date.
A 3-dimensional vector, especially a position on (or rather w.r.t. Earth). Internally represented as a Vector<Double> with assumed units of , independent of the constructing units. Normally given as a longitude, latitude and height (geodetic), or as a vector with origin in center of Earth.
The internal value of the MPosition class (i.e. MVPosition) is also the base class for the contents of the other 3-dimensional position and direction classes:
MPosition | ||
Code | Description | Frame info
|
ITRF | International Terrestrial Reference Frame |
|
WGS84 | World Geodetic System |
|
DEFAULT |
|
|
A 3-dimensional vector of unit length, indicating a direction, especially a direction in space (note that for the Solar system bodies the distance to the bodies is inherently known).
The solar system bodies’ directions are virtual directions. They have
no value until explicitly converted to a real coordinate system like
,
,
…
MDirection | ||
Code | Description | Frame info
|
J2000 | mean equator, equinox J2000.0 |
|
JMEAN | mean equator, equinox epoch | MEpoch |
JTRUE | true equator, equinox epoch | MEpoch |
APP | apparent geocentric | MEpoch |
B1950 | mean equator, equinox B1950.0 |
|
BMEAN | mean equator, equinox epoch | MEpoch |
BTRUE | true equator, equinox epoch | MEpoch |
GALACTIC | galactic coordinates |
|
HADEC | topocentric HA/Dec | MEpoch MPosition |
AZEL | topocentric Az/El (N E) | MEpoch |
AZELSW | topocentric Az/El (S W) | MEpoch MPosition |
AZELNE | MEpoch |
|
JNAT | geocentric natural frame | MEpoch |
ECLIPTIC | ecliptic for J2000.0 equator, equinox |
|
MECLIPTIC | ecliptic for mean equator of date | MEpoch |
TECLIPTIC | ecliptic for true equator of date | MEpoch |
SUPERGAL | supergalactic coordinates |
|
ITRF | direction in ITRF Earth frame | MEpoch MPosition |
TOPO | apparent topocentric | MEpoch |
MERCURY | from JPL DE table | MEpoch |
VENUS |
| MEpoch |
MARS |
| MEpoch |
JUPITER |
| MEpoch |
SATURN |
| MEpoch |
URANUS |
| MEpoch |
NEPTUNE |
| MEpoch |
PLUTO |
| MEpoch |
SUN |
| MEpoch |
MOON |
| MEpoch |
COMET | any solar-system body | MEpoch Table2 |
DEFAULT |
|
|
A 3-dimensional vector, indicating a direction with a length (but no defined zero
point). In principle they are identical to the MDirection directions. At the
momemt the solar system bodies are not a valid baseline direction, but that
could change.
MBaseline | ||
Code | Description | Frame info
|
J2000 | mean equator, equinox J2000.0 |
|
JMEAN | mean equator, equinox epoch | MEpoch |
JTRUE | true equator, equinox epoch | MEpoch |
APP | apparent geocentric | MEpoch |
B1950 | mean equator, equinox B1950.0 |
|
BMEAN | mean equator, equinox epoch | MEpoch |
BTRUE | true equator, equinox epoch | MEpoch |
GALACTIC | galactic coordinates |
|
HADEC | topocentric HA/Dec | MEpoch MPosition |
AZEL | topocentric Az/El (N E) | MEpoch |
AZELSW | topocentric Az/El (S W) | MEpoch MPosition |
AZELNE | MEpoch |
|
JNAT | geocentric natural frame | MEpoch |
ECLIPTIC | ecliptic for J2000.0 equator, equinox |
|
MECLIPTIC | ecliptic for mean equator of date | MEpoch |
TECLIPTIC | ecliptic for true equator of date | MEpoch |
SUPERGAL | supergalactic coordinates |
|
ITRF | direction in ITRF Earth frame | MEpoch MPosition |
DEFAULT |
|
|
A 3-dimensional vector, indicating a
-coordinate.
Muvw | ||
Code | Description | Frame info
|
J2000 | mean equator, equinox J2000.0 |
|
JMEAN | mean equator, equinox epoch | MEpoch |
JTRUE | true equator, equinox epoch | MEpoch |
APP | apparent geocentric | MEpoch |
B1950 | mean equator, equinox B1950.0 |
|
BMEAN | mean equator, equinox epoch | MEpoch |
BTRUE | true equator, equinox epoch | MEpoch |
GALACTIC | galactic coordinates |
|
HADEC | topocentric HA/Dec | MEpoch MPosition |
AZEL | topocentric Az/El (N E) | MEpoch |
AZELSW | topocentric Az/El (S W) | MEpoch MPosition |
AZELNE | MEpoch |
|
JNAT | geocentric natural frame | MEpoch |
ECLIPTIC | ecliptic for J2000.0 equator, equinox |
|
MECLIPTIC | ecliptic for mean equator of date | MEpoch |
TECLIPTIC | ecliptic for true equator of date | MEpoch |
SUPERGAL | supergalactic coordinates |
|
ITRF | direction in ITRF Earth frame | MEpoch MPosition |
DEFAULT |
|
|
A 3-dimensional vector: the value of the Earth’ magnetic field. The model used to
calculate the field is the International Geomagnetic Reference Field. The
field
is a virtual field, without any value. It obtains its value after an explicit
conversion to a normal, real coordinate system.
MEarthMagnetic
| ||
Code | Description | Frame info
|
IGRF | the international reference field model | MEpoch |
J2000 | mean equator, equinox J2000.0 |
|
JMEAN | mean equator, equinox epoch | MEpoch |
JTRUE | true equator, equinox epoch | MEpoch |
APP | apparent geocentric | MEpoch |
B1950 | mean equator, equinox B1950.0 |
|
BMEAN | mean equator, equinox epoch | MEpoch |
BTRUE | true equator, equinox epoch | MEpoch |
GALACTIC | galactic coordinates |
|
HADEC | topocentric HA/Dec | MEpoch MPosition |
AZEL | topocentric Az/El (N E) | MEpoch |
AZELSW | topocentric Az/El (S W) | MEpoch MPosition |
AZELNE | MEpoch |
|
JNAT | geocentric natural frame | MEpoch |
ECLIPTIC | ecliptic for J2000.0 equator, equinox |
|
MECLIPTIC | ecliptic for mean equator of date | MEpoch |
TECLIPTIC | ecliptic for true equator of date | MEpoch |
SUPERGAL | supergalactic coordinates |
|
ITRF | direction in ITRF Earth frame | MEpoch MPosition |
DEFAULT |
|
|
The MFrequency class describes the characteristics of an electro-magnetic wave. Internally the value is in , but an MFrequency object can be constructed from any characteristic that is understood (period, frequency, angular frequency, wavelength, wave number, energy, momentum).
The MFrequency class has special methods to convert the frequency from an
MDoppler object, if a rest frequency is known.
MFrequency
| ||
Code | Description | Frame info
|
REST | spectral line rest frequency | MDirection |
LSR | dynamic local standard of rest | MDirection |
LSRK | kinematic local standard of rest | MDirection |
BARY | barycentric frequency | MDirection |
GEO | geocentric frequency | MDirection |
TOPO | topocentric frequency | MDirection |
GALACTO | galactocentric frequency | MDirection |
DEFAULT |
|
|
The MRadialVelocity class describes the radial velocity of an astronomical object. Internally
the value is in .
Methods are available (if the rest frequency of a spectral line is known), to
convert the velocity to a frequency. Also, the radial velocity can be derived from
an MDoppler object, which has the radial velocity in the often better known
redshift or radio-astronomical Doppler shift.
MRadialVelocity
| ||
Code | Description | Frame info
|
LSR | dynamic local standard of rest | MDirection |
LSRK | kinematic local standard of rest | MDirection |
BARY | barycentric frequency | MDirection |
GEO | geocentric frequency | MDirection |
TOPO | topocentric frequency | MDirection |
GALACTO | galactocentric frequency | MDirection |
DEFAULT |
|
|
The MDoppler class describes the radial velocity of an astronomical object in a variety of special astronomical “Doppler” shifts. It can be generated from quasi velocities; or from a dimensionless quantity, interpreted as a fraction of the velocity of light.
Conversion to a “real” radial velocity is possible with this class. In the following
stands
for ,
where is
the rest frequency.
MDoppler
| ||
Code | Description | Frame info
|
RADIO | radio definition: |
|
Z | redshift: |
|
RATIO | frequency ratio: |
|
BETA | relativistic: |
|
GAMMA |
|
|
OPTICAL |
|
|
RELATIVISTIC |
|
|
DEFAULT |
|
|
1Note the unfortunate circumstance that the classes and , which are not MeasValues, but only formatting classes for times and angles, were named as such.
2The table needed contains a list of directions and distances as a function of . The table can be generated from a standard formatted ascii text by the measuresdata Glish module. See there for how to generate a table. In future an driven parser could be used