casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RadialVelocityEngine.h
Go to the documentation of this file.
1 //# RadialVelocityEngine.h: Engine for TaQL UDF RadialVelocity 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_RADIALVELOCITYENGINE_H
29 #define MEAS_RADIALVELOCITYENGINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
37 
38 namespace casacore {
39 
40  //# Forward declarations
41  class DopplerEngine;
42  class DirectionEngine;
43  class EpochEngine;
44  class PositionEngine;
45 
46 
47  // <summary>
48  // Engine for TaQL UDF RadialVelocity conversions
49  // </summary>
50 
51  // <use visibility=export>
52 
53  // <reviewed reviewer="" date="" tests="tMeas.cc">
54  // </reviewed>
55 
56  // <prerequisite>
57  //# Classes you should understand before using this one.
58  // <li> EngineBase
59  // </prerequisite>
60 
61  // <synopsis>
62  // RadialVelocityEngine defines Engines (user defined functions) that can be used
63  // in TaQL to convert Measures for radial velocities.
64  // In this way such derived values appear to be ordinary TaQL functions.
65  //
66  // RadialVelocity conversions require a MeasFrame containing sky direction,
67  // epoch and position on earth.
68  // In TaQL these functions can be called like:
69  // <srcblock>
70  // meas.rv ('TOPO', 1 'm/s', 'LSRK', 'CasA', date(),
71  // [1e6m,1e6m,1e6m], 'WGS84')
72  // </srcblock>
73  // which converts the radial velocity from LSRK to TOPO.
74  // <ul>
75  // <li>
76  // <src>toref</src> is a single constant string.
77  // <li>
78  // <src>pos</src> can have various value types. A single numeric array is
79  // a series of RA,DEC in J2000. If given as a set, the last argument of the
80  // set can be the reference types of the values in the set. The values can
81  // be strings (indicating planetary objects) or value pairs giving lon,lat.
82  // The default reference type is J2000.
83  // </ul>
84  // All such functions return data with type double and unit Hz.
85  //
86  // Radial velocities can be given like:
87  // [v1,v2,...], fromRef
88  // where fromRef is the reference type.
89  //
90  // A radial velocity can also be a table column which usually knows its type.
91  // It can also be an expression (e.g. RADIALVELOCITY[0,]) which also knows the type.
92  // </synopsis>
93 
94  // <motivation>
95  // It makes it possible to handle measures in TaQL.
96  // </motivation>
97 
98  class RadialVelocityEngine: public MeasEngine<MRadialVelocity>
99  {
100  public:
102 
103  // Get the values.
105 
106  // Get the radial velocities.
108 
109  // Handle the argument(s) giving the input radial velocities and reference type.
110  // The radial velocity can be a column in a table.
111  // If 'proper' is True, it is tested if a proper radial velocity is given
112  // (with proper unit and/or type). If not. False is returned.
113  // If 'proper' is False, the value is always considered as radial velocity.
114  void handleRadialVelocity (std::vector<TENShPtr>& args,
115  uInt& argnr);
116 
117  // Set the MeasConvert object.
118  void setConverter (MRadialVelocity::Types toType);
119 
120  // Set the possible doppler engine.
121  // It can be done only once.
122  void setDopplerEngine (DopplerEngine& engine);
123 
124  // Set the possible direction engine.
125  // It can be done only once.
126  void setDirectionEngine (DirectionEngine& engine);
127 
128  // Set the possible epoch engine.
129  // It can be done only once.
130  void setEpochEngine (EpochEngine& engine);
131 
132  // Set the possible position engine.
133  // It can be done only once.
134  void setPositionEngine (PositionEngine& engine);
135 
136  private:
137  virtual void handleValues (TableExprNode& operand,
138  const TableExprId& id,
139  Array<MRadialVelocity>& radialVelocities);
140 
141  //# Data members.
142  MeasFrame itsFrame; //# frame used by converter
148  };
149 
150 } //end namespace
151 
152 #endif
Array< MRadialVelocity > getRadialVelocities(const TableExprId &id)
Get the radial velocities.
Array< Double > getArrayDouble(const TableExprId &id)
Get the values.
void setPositionEngine(PositionEngine &engine)
Set the possible position engine.
void setDopplerEngine(DopplerEngine &engine)
Set the possible doppler engine.
Templated base class for the TaQL UDF conversion engines.
Definition: MeasEngine.h:92
Handle class for a table column expression tree.
Definition: ExprNode.h:155
Engine for TaQL UDF RadialVelocity conversions.
Container for Measure frame.
Definition: MeasFrame.h:137
Engine for TaQL UDF Position conversions.
void setEpochEngine(EpochEngine &engine)
Set the possible epoch engine.
Engine for TaQL UDF Epoch conversions.
Definition: EpochEngine.h:90
Engine for TaQL UDF Direction conversions.
MRadialVelocity::Convert itsConverter
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
void handleRadialVelocity(std::vector< TENShPtr > &args, uInt &argnr)
Handle the argument(s) giving the input radial velocities and reference type.
The identification of a TaQL selection subject.
Definition: TableExprId.h:97
Engine for TaQL UDF Doppler conversions.
Definition: DopplerEngine.h:98
void setDirectionEngine(DirectionEngine &engine)
Set the possible direction engine.
virtual void handleValues(TableExprNode &operand, const TableExprId &id, Array< MRadialVelocity > &radialVelocities)
Let a derive class handle the values.
unsigned int uInt
Definition: aipstype.h:51
void setConverter(MRadialVelocity::Types toType)
Set the MeasConvert object.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42