casacore
Loading...
Searching...
No Matches
FrequencyUDF.h
Go to the documentation of this file.
1// # FrequencyUDF.h: TaQL UDFs for Frequency conversions
2// # Copyright (C) 2016
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef MEAS_FREQUENCYUDF_H
27#define MEAS_FREQUENCYUDF_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/meas/MeasUDF/FrequencyEngine.h>
32#include <casacore/meas/MeasUDF/RadialVelocityEngine.h>
33#include <casacore/meas/MeasUDF/DopplerEngine.h>
34#include <casacore/meas/MeasUDF/DirectionEngine.h>
35#include <casacore/meas/MeasUDF/EpochEngine.h>
36#include <casacore/meas/MeasUDF/PositionEngine.h>
37#include <casacore/tables/TaQL/UDFBase.h>
38
39namespace casacore {
40
41// <summary>
42// TaQL UDFs for Frequency conversions.
43// </summary>
44
45// <use visibility=export>
46
47// <reviewed reviewer="" date="" tests="tMeas.cc">
48// </reviewed>
49
50// <prerequisite>
51// # Classes you should understand before using this one.
52// <li> UDFBase
53// </prerequisite>
54
55// <synopsis>
56// FrequencyUDF defines UDFs (user defined functions) that can be used in TaQL
57// to convert Measures for frequencys.
58// Special functions exist to convert to hourangle and azimuth/elevation.
59// In this way such derived values appear to be ordinary TaQL functions.
60//
61// A function is called like:
62// <srcblock>
63// meas.dir (toref, dir, time, pos)
64// meas.dir (toref, dir, time, pos)
65// For example,
66// meas.dir ('B1950', [2rad,1rad])
67// meas.dir ('B1950', [[2rad,1rad], 'J2000'])
68// meas.dir ('APP', 'MOON', TIME, [[5d12m, 52deg, 11m], 'WGS84'])
69// meas.dir ('APP', 'MOON', TIME, POSITION)
70// Or
71// meas.dir (toref, fromref, dir, pos, time)
72// </srcblock>
73// <ul>
74// <li>
75// <src>toref</src> is a single constant string.
76// <li>
77// <src>dir</src> can have various value types. A single numeric array is
78// a series of RA,DEC in J2000. If given as a set, the last argument of the
79// set can be the reference types of the values in the set. The values can
80// be strings (indicating planetary objects) or value pairs giving lon,lat.
81// The default reference type is J2000.
82// </ul>
83// All functions have data type double and unit radian.
84// </synopsis>
85
86// <motivation>
87// It makes it possible to handle measures in TaQL.
88// </motivation>
89
90class FrequencyUDF : public UDFBase {
91 public:
92 // Define the possible function types.
94
95 // Create for the given function type.
97
98 // Function to create an object.
99 static UDFBase* makeFREQ(const String&);
100 static UDFBase* makeREST(const String&);
101 static UDFBase* makeSHIFT(const String&);
102
103 // Setup the object.
104 virtual void setup(const Table&, const TaQLStyle&);
105
106 // Get the value.
107 virtual Double getDouble(const TableExprId& id);
109
110 private:
111 // Handle a radial velocity or optionally doppler for REST conversion.
112 // It returns True if Doppler is used.
113 Bool handleRadVelDoppler(uInt& argnr, Bool mustRadVel);
114
115 // # Data members.
117 DopplerEngine itsDopplerEngine; // # for frequency shift
118 RadialVelocityEngine itsRadVelEngine; // # for rest frequency
124};
125
126} // namespace casacore
127
128#endif
PositionEngine itsPositionEngine
DopplerEngine itsDopplerEngine
DirectionEngine itsDirectionEngine
virtual MArray< Double > getArrayDouble(const TableExprId &id)
static UDFBase * makeREST(const String &)
static UDFBase * makeFREQ(const String &)
Function to create an object.
RadialVelocityEngine itsRadVelEngine
FrequencyEngine itsEngine
static UDFBase * makeSHIFT(const String &)
virtual Double getDouble(const TableExprId &id)
Get the value.
FrequencyUDF(FuncType)
Create for the given function type.
virtual void setup(const Table &, const TaQLStyle &)
Setup the object.
Bool handleRadVelDoppler(uInt &argnr, Bool mustRadVel)
Handle a radial velocity or optionally doppler for REST conversion.
MFrequency::Types itsRefType
FuncType
Define the possible function types.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:175
String: the storage and methods of handling collections of characters.
Definition String.h:355
UDFBase()
Only default constructor is needed.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53