Engine for TaQL UDF Direction conversions
Intended use:
Public interface
Review Status
- Test programs:
- tMeas
Prerequisite
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
meas.riseset (
'SUN',
date()+[0:31],
'WSRT')
meas.dircos ('APP', 'CasA', 12mar2015, [52deg,5deg])
meas.j2000 ('cyga') deg
TableExprNode date(const TableExprNode &node)
Motivation
It makes it possible to easily handle measures in TaQL.
Definition at line 139 of file DirectionEngine.h.