casacore
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: aips2-request@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 //# $Id$
27 
28 #ifndef MEAS_FREQUENCYUDF_H
29 #define MEAS_FREQUENCYUDF_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/meas/MeasUDF/FrequencyEngine.h>
34 #include <casacore/meas/MeasUDF/RadialVelocityEngine.h>
35 #include <casacore/meas/MeasUDF/DopplerEngine.h>
36 #include <casacore/meas/MeasUDF/DirectionEngine.h>
37 #include <casacore/meas/MeasUDF/EpochEngine.h>
38 #include <casacore/meas/MeasUDF/PositionEngine.h>
39 #include <casacore/tables/TaQL/UDFBase.h>
40 
41 namespace casacore {
42 
43 // <summary>
44 // TaQL UDFs for Frequency conversions.
45 // </summary>
46 
47 // <use visibility=export>
48 
49 // <reviewed reviewer="" date="" tests="tMeas.cc">
50 // </reviewed>
51 
52 // <prerequisite>
53 //# Classes you should understand before using this one.
54 // <li> UDFBase
55 // </prerequisite>
56 
57 // <synopsis>
58 // FrequencyUDF defines UDFs (user defined functions) that can be used in TaQL
59 // to convert Measures for frequencys.
60 // Special functions exist to convert to hourangle and azimuth/elevation.
61 // In this way such derived values appear to be ordinary TaQL functions.
62 //
63 // A function is called like:
64 // <srcblock>
65 // meas.dir (toref, dir, time, pos)
66 // meas.dir (toref, dir, time, pos)
67 // For example,
68 // meas.dir ('B1950', [2rad,1rad])
69 // meas.dir ('B1950', [[2rad,1rad], 'J2000'])
70 // meas.dir ('APP', 'MOON', TIME, [[5d12m, 52deg, 11m], 'WGS84'])
71 // meas.dir ('APP', 'MOON', TIME, POSITION)
72 // Or
73 // meas.dir (toref, fromref, dir, pos, time)
74 // </srcblock>
75 // <ul>
76 // <li>
77 // <src>toref</src> is a single constant string.
78 // <li>
79 // <src>dir</src> can have various value types. A single numeric array is
80 // a series of RA,DEC in J2000. If given as a set, the last argument of the
81 // set can be the reference types of the values in the set. The values can
82 // be strings (indicating planetary objects) or value pairs giving lon,lat.
83 // The default reference type is J2000.
84 // </ul>
85 // All functions have data type double and unit radian.
86 // </synopsis>
87 
88 // <motivation>
89 // It makes it possible to handle measures in TaQL.
90 // </motivation>
91 
92  class FrequencyUDF: public UDFBase
93  {
94  public:
95  // Define the possible function types.
97 
98  // Create for the given function type.
99  explicit FrequencyUDF (FuncType);
100 
101  // Function to create an object.
102  static UDFBase* makeFREQ (const String&);
103  static UDFBase* makeREST (const String&);
104  static UDFBase* makeSHIFT (const String&);
105 
106  // Setup the object.
107  virtual void setup (const Table&, const TaQLStyle&);
108 
109  // Get the value.
110  virtual Double getDouble (const TableExprId& id);
112 
113  private:
114  // Handle a radial velocity or optionally doppler for REST conversion.
115  // It returns True if Doppler is used.
116  Bool handleRadVelDoppler (uInt& argnr, Bool mustRadVel);
117 
118  //# Data members.
120  DopplerEngine itsDopplerEngine; //# for frequency shift
121  RadialVelocityEngine itsRadVelEngine; //# for rest frequency
127  };
128 
129 } //end namespace
130 
131 #endif
PositionEngine itsPositionEngine
Definition: FrequencyUDF.h:124
DopplerEngine itsDopplerEngine
Definition: FrequencyUDF.h:120
static UDFBase * makeSHIFT(const String &)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
DirectionEngine itsDirectionEngine
Definition: FrequencyUDF.h:122
RadialVelocityEngine itsRadVelEngine
Definition: FrequencyUDF.h:121
FrequencyEngine itsEngine
Definition: FrequencyUDF.h:119
EpochEngine itsEpochEngine
Definition: FrequencyUDF.h:123
static UDFBase * makeREST(const String &)
virtual Double getDouble(const TableExprId &id)
Get the value.
static UDFBase * makeFREQ(const String &)
Function to create an object.
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
Definition: FrequencyUDF.h:126
FuncType
Define the possible function types.
Definition: FrequencyUDF.h:96
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55