Loading...
Searching...
No Matches
casacore::DirectionEngine Class Reference
meas package (libcasa_meas) » MeasUDF_module

More...

`#include <DirectionEngine.h>`

## Public Member Functions

| DirectionEngine ()
virtual | ~DirectionEngine ()
Array< Double > | getArrayDouble (const TableExprId &id, Bool riseSet, Bool asDirCos)
| Get the values.
Array< MDirection > | getDirections (const TableExprId &id)
| Get the directions.
void | handleDirection (const std::vector< TENShPtr > &args, uInt &argnr, Bool riseSet, Bool asDirCos)
| Handle the argument(s) giving the input directions and reference type.
void | setConverter (MDirection::Types toType)
| Set the MeasConvert object.
void | setEpochEngine (EpochEngine &engine)
| Set the possible epoch engine.
void | setPositionEngine (PositionEngine &engine)
| Set the possible position engine.
Public Member Functions inherited from casacore::MeasEngine< MDirection >
| MeasEngine ()
virtual | ~MeasEngine ()
MDirection::Types | refType () const
| Get the reference type.
Bool | handleMeasType (const TENShPtr &operand, Bool doThrow)
| Handle a doppler reference type.
Record | makeAttributes (typename MDirection::Types refType, Int valueType=1) const
| Make the expression result attributes.
Public Member Functions inherited from casacore::BaseEngine
| BaseEngine ()
virtual | ~BaseEngine ()
void | adaptForConstant (const IPosition &shapeConstant, uInt nvalues=0)
| Adapt the output shape and dimensionality for possible constant values.
void | extendBase (const BaseEngine &, Bool removeFirstAxis=False)
| Extend the shape (if not empty) with the engine's shape.
const IPosition & | shape () const
| Get the output shape.
Int | ndim () const
| Get the output dimensionality.
const Unit & | unit () const
| Get the unit of the function's result.
const Unit & | inUnit () const
| Get the unit of the expression.
Bool | isConstant () const
| Tell if the expression is constant.

## Private Member Functions

void | handleScalars (const TENShPtr &e1, const TENShPtr &e2, const TENShPtr &e3)
void | handleNames (const TENShPtr &operand)
virtual void | handleValues (TableExprNode &operand, const TableExprId &id, Array< MDirection > &directions)
| Let a derive class handle the values.
void | calcRiseSet (const MDirection &dir, const MPosition &pos, const MEpoch &epoch, double h, double &rise, double &set)
| Calucate the rise and set time of a source for a given position and epoch.
int | fillRiseSet (double epoch, const MDirection &dir, double lat, double h, const MEpoch &off, double *rise, double *set)

## Private Attributes

MeasFrame | itsFrame
MDirection::Convert | itsConverter
Vector< Double > | itsH
EpochEngine * | itsEpochEngine
PositionEngine * | itsPositionEngine

## Additional Inherited Members

Protected Member Functions inherited from casacore::MeasEngine< MDirection >
void | handleMeasArray (const TENShPtr &operand)
| Handle the operand representing an array of Meas values.
void | handleConstant (const TENShPtr &operand)
| Handle a constant Meas value.
Protected Member Functions inherited from casacore::BaseEngine
virtual void | deriveAttr (const Unit &unit, Int nval)
| Let a derived class derive its attributes.
virtual void | setValueType (Int valueType)
| Let a derived class set its value type.
virtual String | stripMeasType (const String &type)
| Let a derived class strip part of the reference type.
Protected Attributes inherited from casacore::MeasEngine< MDirection >
Array< MDirection > | itsConstants
MDirection::Types | itsRefType
ScalarMeasColumn< MDirection > | itsMeasScaCol
ArrayMeasColumn< MDirection > | itsMeasArrCol
Protected Attributes inherited from casacore::BaseEngine
Bool | itsIsConst
IPosition | itsShape
Int | itsNDim
Unit | itsInUnit
Unit | itsOutUnit
TableExprNode | itsExprNode

## Detailed Description

Engine for TaQL UDF Direction conversions

### Intended use:

Public interface

### Review Status

Test programs:
  tMeas

### Prerequisite

- EngineBase

### Synopsis

DirectionEngine defines Engines (user defined functions) that can be used in TaQL to convert Measures for directions. In this way such derived values appear to be ordinary TaQL functions.

In TaQL these functions can be called like:

meas.dir (toref, directions, epochs, positions)
meas.j2000 (directions, epochs, positions)
meas.dircos (toref, directions, epochs, positions)
meas.riset (directions, epochs, positions)

The first two result in angles, the third in direction cosines, while the fourth returns the rise/set time of sources as datetimes. Note that the second form is a shorthand for meas.dir('j2000',...). There are more such functions. The exact number of arguments depends on how they are specified.

- toref is a single constant string defining the reference frame to convert to. Note it should be omitted for the functions (e.g., meas.j2000) with an implicit destination reference frame.
- directions is one or more directions which can be given in several ways.
  - An array of directions, each 2 angles or 3 directions cosines. It can be given as a single list or a multi-dim array. The choice between angles and direction cosines is based on the size of the first dimension. If divisible by 2, it is angles, by 3 is direction cosines, otherwise an error. Thus a list of 6 elements defines 3 directions with 2 angles each (default in radians).
    It can be followed by a string defining the source reference frame. It defaults to 'J2000'.
  - If a single constant direction is used, it can be given as 2 (for angles) or 3 (for direction cosines) scalar values, followed by the optional source reference frame.
  - The name of a column in a table or a subset of it such as DELAY_DIR[0,]. Often this is a TableMeasures column which is recognized as such, also its source reference frame. If such a column is given as part of an expression, it will not be recognized as a TableMeasures column and its reference frame should be given.
  - As a list of (case-insensitive) names of known sources such as 'CasA' or 'SUN'.
- epochs can be given as shown in class EpochEngine.
- positions can be given as shown in class PositionEngine.

Note that epochs and positions are only needed if required by the conversion from source reference frame to destination reference frame. For example, J2000 to/from APP needs them, but not J2000 to/from B1950.

The result of the function is an array with shape [2|3,dir,epoch,pos] where the last 3 elements are the shapes of these arguments. They are omitted if all of them have length 1.

Futhermore, it is possible to get the rise/set date/time of a source given the source direction, date and position on earth. These functions return data with type double and unit d (day). If the source is visible all day, the rise time is 0 and set time 1. If the source is not visible at all, the rise time is 1 and set time 0. For the sun and the moon it is possible to add a suffix to the name telling if and which edge and twilight should be used. For the sun and moon the default is -UR (the upper edge with refraction correction).

### Example

// Get rise/set time of the upper edge of the sun in the coming month
// at the WSRT site.
meas.riseset ('SUN', date()+[0:31], 'WSRT')
// Get the apparent coordinates of CasA for the given date and position.
meas.dircos ('APP', 'CasA', 12mar2015, [52deg,5deg])
// Get the J2000 coordinates (in degrees) of CygA.
meas.j2000 ('cyga') deg
casacore::date
TableExprNode date(const TableExprNode &node)
Definition ExprNode.h:1515

### Motivation

It makes it possible to easily handle measures in TaQL.

Definition at line 139 of file DirectionEngine.h.

## Constructor & Destructor Documentation

## DirectionEngine()

casacore::DirectionEngine::DirectionEngine | ( |  | ) |

## ~DirectionEngine()

virtual casacore::DirectionEngine::~DirectionEngine | ( |  | ) |

virtual

## Member Function Documentation

## calcRiseSet()

void casacore::DirectionEngine::calcRiseSet | ( | const MDirection & | dir,
|  | const MPosition & | pos,
|  | const MEpoch & | epoch,
|  | double | h,
|  | double & | rise,
|  | double & | set )

private

Calucate the rise and set time of a source for a given position and epoch.

Argument h defines the possible edge of sun/moon.

References casacore::set().

## fillRiseSet()

int casacore::DirectionEngine::fillRiseSet | ( | double | epoch,
|  | const MDirection & | dir,
|  | double | lat,
|  | double | h,
|  | const MEpoch & | off,
|  | double * | rise,
|  | double * | set )

private

References casacore::set().

## getArrayDouble()

Array< Double > casacore::DirectionEngine::getArrayDouble | ( | const TableExprId & | id,
|  | Bool | riseSet,
|  | Bool | asDirCos )

Get the values.

The first Bool tells if rise/set times have to be calculated. The second Bool tells if direction cosines have to be calculated.

## getDirections()

Array< MDirection > casacore::DirectionEngine::getDirections | ( | const TableExprId & | id | ) |

Get the directions.

## handleDirection()

void casacore::DirectionEngine::handleDirection | ( | const std::vector< TENShPtr > & | args,
|  | uInt & | argnr,
|  | Bool | riseSet,
|  | Bool | asDirCos )

Handle the argument(s) giving the input directions and reference type.

The direction can be a column in a table.

## handleNames()

void casacore::DirectionEngine::handleNames | ( | const TENShPtr & | operand | ) |

private

## handleScalars()

void casacore::DirectionEngine::handleScalars | ( | const TENShPtr & | e1,
|  | const TENShPtr & | e2,
|  | const TENShPtr & | e3 )

private

## handleValues()

virtual void casacore::DirectionEngine::handleValues | ( | TableExprNode & | operand,
|  | const TableExprId & | id,
|  | Array< MDirection > & | positions )

private virtual

Let a derive class handle the values.

Implements casacore::MeasEngine< MDirection >.

## setConverter()

void casacore::DirectionEngine::setConverter | ( | MDirection::Types | toType | ) |

Set the MeasConvert object.

## setEpochEngine()

void casacore::DirectionEngine::setEpochEngine | ( | EpochEngine & | engine | ) |

Set the possible epoch engine.

It can be done only once.

## setPositionEngine()

void casacore::DirectionEngine::setPositionEngine | ( | PositionEngine & | engine | ) |

Set the possible position engine.

It can be done only once.

## Member Data Documentation

## itsConverter

MDirection::Convert casacore::DirectionEngine::itsConverter

private

Definition at line 195 of file DirectionEngine.h.

## itsEpochEngine

EpochEngine* casacore::DirectionEngine::itsEpochEngine

private

Definition at line 197 of file DirectionEngine.h.

## itsFrame

MeasFrame casacore::DirectionEngine::itsFrame

private

Definition at line 194 of file DirectionEngine.h.

## itsH

Vector<Double> casacore::DirectionEngine::itsH

private

Definition at line 196 of file DirectionEngine.h.

## itsPositionEngine

PositionEngine* casacore::DirectionEngine::itsPositionEngine

private

Definition at line 198 of file DirectionEngine.h.

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

- meas/MeasUDF/DirectionEngine.h