Loading...
Searching...
No Matches
casacore::MeasFrame Class Reference
measures package (libcasa_measures) » Measures_module

More...

`#include <MeasFrame.h>`

## Public Types

enum | FrameTypes { EPOCH , POSITION , DIRECTION , VELOCITY , COMET }
| Enumeration for the different farme entries possible. More...

## Public Member Functions

| MeasFrame ()
| Default constructor.
| MeasFrame (const Measure &meas1)
| Construct frame with specified measures.
| MeasFrame (const Measure &meas1, const Measure &meas2)
| MeasFrame (const Measure &meas1, const Measure &meas2, const Measure &meas3)
| MeasFrame (const MeasFrame &other)
| Copy constructor (reference semantics).
| MeasFrame (MeasFrame &&other)
MeasFrame & | operator= (const MeasFrame &other)
| Copy assignment (reference semantics).
MeasFrame & | operator= (MeasFrame &&other)
| ~MeasFrame ()
| Destructor.
Bool | operator== (const MeasFrame &other) const
| Comparisons.
Bool | operator!= (const MeasFrame &other) const
Bool | empty () const
| Test if empty (i.e.
void | set (const Measure &meas1)
| Set frame elements.
void | set (const Measure &meas1, const Measure &meas2)
void | set (const Measure &meas1, const Measure &meas2, const Measure &meas3)
void | set (const MeasComet &meas)
void | resetEpoch (Double val)
| Reset a frame element and its cached derived values.
void | resetEpoch (const Vector< Double > &val)
void | resetEpoch (const Quantum< Double > &val)
void | resetEpoch (const Quantum< Vector< Double > > &val)
void | resetEpoch (const MVEpoch &val)
void | resetEpoch (const Measure &val)
void | resetPosition (const Vector< Double > &val)
void | resetPosition (const Quantum< Vector< Double > > &val)
void | resetPosition (const MVPosition &val)
void | resetPosition (const Measure &val)
void | resetDirection (const Vector< Double > &val)
void | resetDirection (const Quantum< Vector< Double > > &val)
void | resetDirection (const MVDirection &val)
void | resetDirection (const Measure &val)
void | resetRadialVelocity (const Vector< Double > &val)
void | resetRadialVelocity (const Quantum< Vector< Double > > &val)
void | resetRadialVelocity (const MVRadialVelocity &val)
void | resetRadialVelocity (const Measure &val)
void | resetComet (const MeasComet &val)
const Measure * | epoch () const
| Get the epoch pointer (0 if not present).
const Measure * | position () const
| Get the position pointer (0 if not present).
const Measure * | direction () const
| Get the direction pointer (0 if not present).
const Measure * | radialVelocity () const
| Get the radial velocity pointer (0 if not present).
const MeasComet * | comet () const
| Get the comet pointer (0 if not present).
Bool | getTDB (Double &tdb) const
| Get data from frame.
Bool | getUT1 (Double &tdb) const
| Get UT1 in days.
Bool | getTT (Double &tdb) const
| Get TT in days.
Bool | getLong (Double &tdb) const
| Get the ITRF longitude (in rad).
Bool | getLat (Double &tdb) const
| Get the ITRF latitude (in rad).
Bool | getITRF (MVPosition &tdb) const
| Get the position.
Bool | getRadius (Double &tdb) const
| Get the geocentric position (in m).
Bool | getLatGeo (Double &tdb) const
| Get the geodetic latitude.
Bool | getLAST (Double &tdb) const
| Get the LAST (in days).
Bool | getLASTr (Double &tdb) const
| Get the LAST (in rad).
Bool | getJ2000 (MVDirection &tdb) const
| Get J2000 coordinates (direction cosines) and its longitude/latitude (rad).
Bool | getJ2000Long (Double &tdb) const
Bool | getJ2000Lat (Double &tdb) const
Bool | getB1950 (MVDirection &tdb) const
| Get B1950 coordinates (direction cosines).
Bool | getB1950Long (Double &tdb) const
Bool | getB1950Lat (Double &tdb) const
Bool | getApp (MVDirection &tdb) const
| Get apparent coordinates (direction cosines).
Bool | getAppLong (Double &tdb) const
Bool | getAppLat (Double &tdb) const
Bool | getLSR (Double &tdb) const
| Get LSR radial velocity (m/s).
Bool | getCometType (uInt &tdb) const
| Get the comet table reference type.
Bool | getComet (MVPosition &tdb) const
| Get the comet coordinates.
MeasFrame | independentCopy () const
| Make a value copy of this MeasFrame, such that it contains no reference to the old MeasFrame data.

## Private Member Functions

| MeasFrame (details::CyclicPtr< FrameRep > new_rep)
void | create ()
| Create an instance of the MeasFrame class.
void | fill (const Measure *in)
| Fill a MeasFrame element.
void | fill (const MeasComet *in)
void | makeEpoch ()
| Make full Epoch.
void | makePosition ()
| Make full Position.
void | makeDirection ()
| Make full Direction.
void | makeRadialVelocity ()
| Make full RadialVelocity.
void | makeComet ()
| Make full Comet.
void | errorReset (const String &txt)
| Throw reset error.

## Private Attributes

details::CyclicPtr< FrameRep > | rep
| Representation of MeasFrame.

## Friends

class | MCFrame
| Machinery.
ostream & | operator<< (ostream &os, MeasFrame &mf)
| Output a frame.

## Detailed Description

Container for Measure frame

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- Measure class
- MeasRef class

### Etymology

From Measure and Frame

### Synopsis

Measurements are made in a reference frame (epoch, position, direction, ...).

The class is a container for the reference frame Measures (MEpoch etc). Since a frame will possibly be used by many different Measures, it behaves as a smart pointer, with reference rather than copy characteristics. Since it caches all its operations, it is advisable to have a 'global' MeasFrame across an execution, resetting (or setting) its values when appropriate. The frame can also contain other related information. At the moment the orbit of a solar system body (MeasComet) can be set. In future the planetary ephemeris used (e.g. DE205) and environmental information like refraction data will be added.

A MeasFrame is constructed by setting the appropriate Measures, either in a constructor, or with a set(). The input to the constructors and set are Measures.

Inside the frames automatic conversion to the most appropriate usage of its values is done (e.g. time to TBD time, position to astronomical longitude). These conversions are done only if an explicit Measure::Convert was used that needed information, e.g. the following code:

MeasFrame frame(obser); // obser is an MPosition
MEpoch::Convert conv(MEpoch(12345), MEpoch::Ref(MEpoch::LAST,obser));
MEpoch last = conv();
casacore::MEpoch
Definition MEpoch.h:101
casacore::MEpoch::LAST
@ LAST
Local Apparent Sidereal Time.
Definition MEpoch.h:116
casacore::MEpoch::Ref
MeasRef< MEpoch > Ref
Measure reference (i.e.
Definition MEpoch.h:153
casacore::MEpoch::Convert
MeasConvert< MEpoch > Convert
Measure Convert (i.e.
Definition MEpoch.h:155
casacore::MeasFrame::MeasFrame
MeasFrame()
Default constructor.

will set-up a state machine to convert UTC(default) to LAST in conv; the next call will do the actual conversion. During this conversion, the astronomical longitude (among others) will be needed to convert to local sidereal time. conv will ask (getLong()) this from the frame, which will calculate it (including possible other conversions) from the observatory's position specified in a frame. Any calculation done will be cached (e.g. a Nutation calculation in this case for dpsi), and used in subsequent conversions using the same frame.

Furthermore, a frame will often be regularly updated (e.g. coordinate conversion for a series of times). To make use of cached information, and to speed up as much as possible, reset...() functions are available. These reset functions accept the same range of input parameter types as the MeasConvert () operator, and will keep any determined conversion machines and related information intact, only recalculating whatever is necessary.

The actual frame calculations and interrogations are done in a separate MCFrame hidden class, which attaches itself to MeasFrame when and if necessary (see there if you are really curious).

get...() functions can return frame measures. Only when the frame has been attached to a calculating machine *MCFrame) are these values available. This attachment is done if the frame has been actively used by a Measure::Convert engine, or if explicitly done by the MCFrame::make(MeasFrame &) static method.

Because MeasFrame uses a reference to its implementation, which can be shared by multiple MeasFrame instances, it is by default not thread safe when different MeasFrames are accessed from different threads. Moreover, a MeasFrame contains links to other objects which may also be shared. In Casacore 3.8, the referenced data entries in this class have been changed so they are initialized in thread-safe ways, and thread-safe conversions can be achieved by using the independentCopy() method. See the help for that function for more info.

Caution: An explicit (or implicit) call to MCFrame::make will load the whole conversion machinery (including Tables) into your linked module);

Aipsrc keywords can be used for additional (highly specialised) additional internal conversion parameters.

### Example

MEpoch my_epoch(Quantity(MeasData::MJDB1950,"d")); // an epoch
MeasFrame frame(my_epoch); // used in a frame
casacore::MeasData::MJDB1950
static const Double MJDB1950
MJD of B1950.0.
Definition MeasData.h:106
casacore::Quantity
Quantum< Double > Quantity
Definition Quantum.h:39

### Motivation

To separate the frame definition from the measure type

Definition at line 151 of file MeasFrame.h.

## Member Enumeration Documentation

## FrameTypes

enum casacore::MeasFrame::FrameTypes

Enumeration for the different farme entries possible.

This can be used to find out if a certain conversion needs the frame. It will be used in a registration/notify environment to enable bypassing of some new conversion settings.

Enumerator
EPOCH |
POSITION |
DIRECTION |
VELOCITY |
COMET |

Definition at line 168 of file MeasFrame.h.

## Constructor & Destructor Documentation

## MeasFrame() [1/7]

casacore::MeasFrame::MeasFrame | ( |  | ) |

Default constructor.

Referenced by independentCopy(), MeasFrame(), MeasFrame(), operator!=(), operator<<, operator=(), operator=(), and operator==().

## MeasFrame() [2/7]

casacore::MeasFrame::MeasFrame | ( | const Measure & | meas1 | ) |

Construct frame with specified measures.

### Thrown Exceptions

- AipsError if a non-frame Measure

## MeasFrame() [3/7]

casacore::MeasFrame::MeasFrame | ( | const Measure & | meas1,
|  | const Measure & | meas2 )

## MeasFrame() [4/7]

casacore::MeasFrame::MeasFrame | ( | const Measure & | meas1,
|  | const Measure & | meas2,
|  | const Measure & | meas3 )

## MeasFrame() [5/7]

casacore::MeasFrame::MeasFrame | ( | const MeasFrame & | other | ) |

Copy constructor (reference semantics).

References MeasFrame().

## MeasFrame() [6/7]

casacore::MeasFrame::MeasFrame | ( | MeasFrame && | other | ) |

References MeasFrame().

## ~MeasFrame()

casacore::MeasFrame::~MeasFrame | ( |  | ) |

Destructor.

## MeasFrame() [7/7]

casacore::MeasFrame::MeasFrame | ( | details::CyclicPtr< FrameRep > | new_rep | ) |

private

## Member Function Documentation

## comet()

const MeasComet * casacore::MeasFrame::comet | ( |  | ) | const

Get the comet pointer (0 if not present).

## create()

void casacore::MeasFrame::create | ( |  | ) |

private

Create an instance of the MeasFrame class.

## direction()

const Measure * casacore::MeasFrame::direction | ( |  | ) | const

Get the direction pointer (0 if not present).

## empty()

Bool casacore::MeasFrame::empty | ( |  | ) | const

Test if empty (i.e.

no measure filled in)

## epoch()

const Measure * casacore::MeasFrame::epoch | ( |  | ) | const

Get the epoch pointer (0 if not present).

## errorReset()

void casacore::MeasFrame::errorReset | ( | const String & | txt | ) |

private

Throw reset error.

## fill() [1/2]

void casacore::MeasFrame::fill | ( | const MeasComet * | in | ) |

private

## fill() [2/2]

void casacore::MeasFrame::fill | ( | const Measure * | in | ) |

private

Fill a MeasFrame element.

## getApp()

Bool casacore::MeasFrame::getApp | ( | MVDirection & | tdb | ) | const

Get apparent coordinates (direction cosines).

## getAppLat()

Bool casacore::MeasFrame::getAppLat | ( | Double & | tdb | ) | const

## getAppLong()

Bool casacore::MeasFrame::getAppLong | ( | Double & | tdb | ) | const

## getB1950()

Bool casacore::MeasFrame::getB1950 | ( | MVDirection & | tdb | ) | const

Get B1950 coordinates (direction cosines).

## getB1950Lat()

Bool casacore::MeasFrame::getB1950Lat | ( | Double & | tdb | ) | const

## getB1950Long()

Bool casacore::MeasFrame::getB1950Long | ( | Double & | tdb | ) | const

## getComet()

Bool casacore::MeasFrame::getComet | ( | MVPosition & | tdb | ) | const

Get the comet coordinates.

## getCometType()

Bool casacore::MeasFrame::getCometType | ( | uInt & | tdb | ) | const

Get the comet table reference type.

## getITRF()

Bool casacore::MeasFrame::getITRF | ( | MVPosition & | tdb | ) | const

Get the position.

## getJ2000()

Bool casacore::MeasFrame::getJ2000 | ( | MVDirection & | tdb | ) | const

Get J2000 coordinates (direction cosines) and its longitude/latitude (rad).

## getJ2000Lat()

Bool casacore::MeasFrame::getJ2000Lat | ( | Double & | tdb | ) | const

## getJ2000Long()

Bool casacore::MeasFrame::getJ2000Long | ( | Double & | tdb | ) | const

## getLAST()

Bool casacore::MeasFrame::getLAST | ( | Double & | tdb | ) | const

Get the LAST (in days).

## getLASTr()

Bool casacore::MeasFrame::getLASTr | ( | Double & | tdb | ) | const

Get the LAST (in rad).

## getLat()

Bool casacore::MeasFrame::getLat | ( | Double & | tdb | ) | const

Get the ITRF latitude (in rad).

## getLatGeo()

Bool casacore::MeasFrame::getLatGeo | ( | Double & | tdb | ) | const

Get the geodetic latitude.

## getLong()

Bool casacore::MeasFrame::getLong | ( | Double & | tdb | ) | const

Get the ITRF longitude (in rad).

## getLSR()

Bool casacore::MeasFrame::getLSR | ( | Double & | tdb | ) | const

Get LSR radial velocity (m/s).

## getRadius()

Bool casacore::MeasFrame::getRadius | ( | Double & | tdb | ) | const

Get the geocentric position (in m).

## getTDB()

Bool casacore::MeasFrame::getTDB | ( | Double & | tdb | ) | const

Get data from frame.

Only available if appropriate measures are set, and the frame is in a calculating state.

Get TDB in days

## getTT()

Bool casacore::MeasFrame::getTT | ( | Double & | tdb | ) | const

Get TT in days.

## getUT1()

Bool casacore::MeasFrame::getUT1 | ( | Double & | tdb | ) | const

Get UT1 in days.

## independentCopy()

MeasFrame casacore::MeasFrame::independentCopy | ( |  | ) | const

Make a value copy of this MeasFrame, such that it contains no reference to the old MeasFrame data.

This is useful for ensuring thread safety in conversions.

This function is available since casacore v3.8.0.

The following is an example of how a thread-safe conversion can be performed:

void convert_example(const MDirection& shared_direction, const MeasFrame& shared_frame) {
const MeasFrame frame = shared_frame.independentCopy();
MDirection::Convert converter(MDirection::J2000,
MDirection::Ref(MDirection::ITRF, frame));
MDirection result = converter(shared_direction);
casacore::MDirection
Definition MDirection.h:171
casacore::MDirection::Convert
MeasConvert< MDirection > Convert
Measure Convert (i.e.
Definition MDirection.h:246
casacore::MDirection::Ref
MeasRef< MDirection > Ref
Measure reference (i.e.
Definition MDirection.h:244
casacore::MDirection::ITRF
@ ITRF
Definition MDirection.h:205
casacore::MDirection::J2000
@ J2000
Definition MDirection.h:186
casacore::MeasFrame::independentCopy
MeasFrame independentCopy() const
Make a value copy of this MeasFrame, such that it contains no reference to the old MeasFrame data.

The convert_example() function can be called from multiple threads (as long as they don't write to shared_direction or shared_frame), and performs a direction conversion from J2000 to ITRF. Any information that is shared between the threads is read-only.

References MeasFrame().

## makeComet()

void casacore::MeasFrame::makeComet | ( |  | ) |

private

Make full Comet.

## makeDirection()

void casacore::MeasFrame::makeDirection | ( |  | ) |

private

Make full Direction.

## makeEpoch()

void casacore::MeasFrame::makeEpoch | ( |  | ) |

private

Make full Epoch.

## makePosition()

void casacore::MeasFrame::makePosition | ( |  | ) |

private

Make full Position.

## makeRadialVelocity()

void casacore::MeasFrame::makeRadialVelocity | ( |  | ) |

private

Make full RadialVelocity.

## operator!=()

Bool casacore::MeasFrame::operator!= | ( | const MeasFrame & | other | ) | const

References MeasFrame().

## operator=() [1/2]

MeasFrame & casacore::MeasFrame::operator= | ( | const MeasFrame & | other | ) |

Copy assignment (reference semantics).

References MeasFrame().

## operator=() [2/2]

MeasFrame & casacore::MeasFrame::operator= | ( | MeasFrame && | other | ) |

References MeasFrame().

## operator==()

Bool casacore::MeasFrame::operator== | ( | const MeasFrame & | other | ) | const

Comparisons.

References MeasFrame().

## position()

const Measure * casacore::MeasFrame::position | ( |  | ) | const

Get the position pointer (0 if not present).

## radialVelocity()

const Measure * casacore::MeasFrame::radialVelocity | ( |  | ) | const

Get the radial velocity pointer (0 if not present).

## resetComet()

void casacore::MeasFrame::resetComet | ( | const MeasComet & | val | ) |

## resetDirection() [1/4]

void casacore::MeasFrame::resetDirection | ( | const Measure & | val | ) |

## resetDirection() [2/4]

void casacore::MeasFrame::resetDirection | ( | const MVDirection & | val | ) |

## resetDirection() [3/4]

void casacore::MeasFrame::resetDirection | ( | const Quantum< Vector< Double > > & | val | ) |

## resetDirection() [4/4]

void casacore::MeasFrame::resetDirection | ( | const Vector< Double > & | val | ) |

## resetEpoch() [1/6]

void casacore::MeasFrame::resetEpoch | ( | const Measure & | val | ) |

## resetEpoch() [2/6]

void casacore::MeasFrame::resetEpoch | ( | const MVEpoch & | val | ) |

## resetEpoch() [3/6]

void casacore::MeasFrame::resetEpoch | ( | const Quantum< Double > & | val | ) |

## resetEpoch() [4/6]

void casacore::MeasFrame::resetEpoch | ( | const Quantum< Vector< Double > > & | val | ) |

## resetEpoch() [5/6]

void casacore::MeasFrame::resetEpoch | ( | const Vector< Double > & | val | ) |

## resetEpoch() [6/6]

void casacore::MeasFrame::resetEpoch | ( | Double | val | ) |

Reset a frame element and its cached derived values.

### Thrown Exceptions

- AipsError if the specific Measure not yet present in frame

## resetPosition() [1/4]

void casacore::MeasFrame::resetPosition | ( | const Measure & | val | ) |

## resetPosition() [2/4]

void casacore::MeasFrame::resetPosition | ( | const MVPosition & | val | ) |

## resetPosition() [3/4]

void casacore::MeasFrame::resetPosition | ( | const Quantum< Vector< Double > > & | val | ) |

## resetPosition() [4/4]

void casacore::MeasFrame::resetPosition | ( | const Vector< Double > & | val | ) |

## resetRadialVelocity() [1/4]

void casacore::MeasFrame::resetRadialVelocity | ( | const Measure & | val | ) |

## resetRadialVelocity() [2/4]

void casacore::MeasFrame::resetRadialVelocity | ( | const MVRadialVelocity & | val | ) |

## resetRadialVelocity() [3/4]

void casacore::MeasFrame::resetRadialVelocity | ( | const Quantum< Vector< Double > > & | val | ) |

## resetRadialVelocity() [4/4]

void casacore::MeasFrame::resetRadialVelocity | ( | const Vector< Double > & | val | ) |

## set() [1/4]

void casacore::MeasFrame::set | ( | const MeasComet & | meas | ) |

## set() [2/4]

void casacore::MeasFrame::set | ( | const Measure & | meas1 | ) |

Set frame elements.

### Thrown Exceptions

- AipsError if a non-frame Measure
- AipsError if illegal or non-existant MeasComet given

## set() [3/4]

void casacore::MeasFrame::set | ( | const Measure & | meas1,
|  | const Measure & | meas2 )

## set() [4/4]

void casacore::MeasFrame::set | ( | const Measure & | meas1,
|  | const Measure & | meas2,
|  | const Measure & | meas3 )

## Friends And Related Symbol Documentation

## MCFrame

friend class MCFrame

friend

Machinery.

Definition at line 160 of file MeasFrame.h.

References MCFrame.

Referenced by MCFrame.

## operator<<

ostream & operator<< | ( | ostream & | os,
|  | MeasFrame & | mf )

friend

Output a frame.

References MeasFrame().

## Member Data Documentation

## rep

details::CyclicPtr<FrameRep> casacore::MeasFrame::rep

private

Representation of MeasFrame.

See the CyclicPtr class documentation for motivation.

Definition at line 328 of file MeasFrame.h.

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

- measures/Measures/MeasFrame.h