casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::DirectionEngine Class Reference

More...

#include <DirectionEngine.h>

Public Member Functions

 DirectionEngine ()
 
virtual ~DirectionEngine ()
 
Array< DoublegetArrayDouble (const TableExprId &id, Bool riseSet, Bool asDirCos)
 Get the values. More...
 
Array< MDirectiongetDirections (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 ()
 
M::Types refType () const
 Get the reference type. More...
 
Bool handleMeasType (const TENShPtr &operand, Bool doThrow)
 Handle a doppler reference type. More...
 
Record makeAttributes (typename M::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 IPositionshape () const
 Get the output shape. More...
 
Int ndim () const
 Get the output dimensionality. More...
 
const Unitunit () const
 Get the unit of the function's result. More...
 
const UnitinUnit () 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< DoubleitsH
 
EpochEngineitsEpochEngine
 
PositionEngineitsPositionEngine
 

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< MDirectionitsConstants
 
M::Types itsRefType
 
ScalarMeasColumn< MDirectionitsMeasScaCol
 
ArrayMeasColumn< MDirectionitsMeasArrCol
 
- 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

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.

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
TableExprNode date(const TableExprNode &node)
Definition: ExprNode.h:1511

Motivation

It makes it possible to easily handle measures in TaQL.

Definition at line 141 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.

◆ fillRiseSet()

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

◆ 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 
)
privatevirtual

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 197 of file DirectionEngine.h.

◆ itsEpochEngine

EpochEngine* casacore::DirectionEngine::itsEpochEngine
private

Definition at line 199 of file DirectionEngine.h.

◆ itsFrame

MeasFrame casacore::DirectionEngine::itsFrame
private

Definition at line 196 of file DirectionEngine.h.

◆ itsH

Vector<Double> casacore::DirectionEngine::itsH
private

Definition at line 198 of file DirectionEngine.h.

◆ itsPositionEngine

PositionEngine* casacore::DirectionEngine::itsPositionEngine
private

Definition at line 200 of file DirectionEngine.h.


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