casacore
|
Engine for TaQL UDF Direction conversions. More...
#include <DirectionEngine.h>
Public Member Functions | |
DirectionEngine () | |
virtual | ~DirectionEngine () |
Array< Double > | getArrayDouble (const TableExprId &id, Bool riseSet, Bool asDirCos) |
Get the values. More... | |
Array< MDirection > | getDirections (const TableExprId &id) |
Get the directions. More... | |
void | handleDirection (const std::vector< TENShPtr > &args, uInt &argnr, Bool riseSet, Bool asDirCos) |
Handle the argument(s) giving the input directions and reference type. More... | |
void | setConverter (MDirection::Types toType) |
Set the MeasConvert object. More... | |
void | setEpochEngine (EpochEngine &engine) |
Set the possible epoch engine. More... | |
void | setPositionEngine (PositionEngine &engine) |
Set the possible position engine. More... | |
Public Member Functions inherited from casacore::MeasEngine< MDirection > | |
MeasEngine () | |
virtual | ~MeasEngine () |
MDirection::Types | refType () const |
Get the reference type. More... | |
Bool | handleMeasType (const TENShPtr &operand, Bool doThrow) |
Handle a doppler reference type. More... | |
Record | makeAttributes (typename MDirection::Types refType, Int valueType=1) const |
Make the expression result attributes. More... | |
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. More... | |
void | extendBase (const BaseEngine &, Bool removeFirstAxis=False) |
Extend the shape (if not empty) with the engine's shape. More... | |
const IPosition & | shape () const |
Get the output shape. More... | |
Int | ndim () const |
Get the output dimensionality. More... | |
const Unit & | unit () const |
Get the unit of the function's result. More... | |
const Unit & | inUnit () const |
Get the unit of the expression. More... | |
Bool | isConstant () const |
Tell if the expression is constant. More... | |
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. More... | |
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. More... | |
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. More... | |
void | handleConstant (const TENShPtr &operand) |
Handle a constant Meas value. More... | |
Protected Member Functions inherited from casacore::BaseEngine | |
virtual void | deriveAttr (const Unit &unit, Int nval) |
Let a derived class derive its attributes. More... | |
virtual void | setValueType (Int valueType) |
Let a derived class set its value type. More... | |
virtual String | stripMeasType (const String &type) |
Let a derived class strip part of the reference type. More... | |
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 |
Engine for TaQL UDF Direction conversions.
Public interface
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:
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. 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. 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).
It makes it possible to easily handle measures in TaQL.
Definition at line 141 of file DirectionEngine.h.
casacore::DirectionEngine::DirectionEngine | ( | ) |
|
virtual |
|
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.
|
private |
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.
Array<MDirection> casacore::DirectionEngine::getDirections | ( | const TableExprId & | id | ) |
Get the directions.
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.
|
private |
|
private |
|
privatevirtual |
Let a derive class handle the values.
Implements casacore::MeasEngine< MDirection >.
void casacore::DirectionEngine::setConverter | ( | MDirection::Types | toType | ) |
Set the MeasConvert object.
void casacore::DirectionEngine::setEpochEngine | ( | EpochEngine & | engine | ) |
Set the possible epoch engine.
It can be done only once.
void casacore::DirectionEngine::setPositionEngine | ( | PositionEngine & | engine | ) |
Set the possible position engine.
It can be done only once.
|
private |
Definition at line 197 of file DirectionEngine.h.
|
private |
Definition at line 199 of file DirectionEngine.h.
|
private |
Definition at line 196 of file DirectionEngine.h.
Definition at line 198 of file DirectionEngine.h.
|
private |
Definition at line 200 of file DirectionEngine.h.