casacore
DopplerEngine.h
Go to the documentation of this file.
1 //# DopplerEngine.h: Engine for TaQL UDF Doppler 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_DOPPLERENGINE_H
29 #define MEAS_DOPPLERENGINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/meas/MeasUDF/MeasEngine.h>
34 #include <casacore/measures/Measures/MDoppler.h>
35 #include <casacore/measures/Measures/MCDoppler.h>
36 #include <casacore/measures/Measures/MeasConvert.h>
37 #include <casacore/casa/Quanta/MVFrequency.h>
38 #include <memory>
39 
40 namespace casacore {
41 
42  //# Forward Declarations
43  class RadialVelocityEngine;
44  class FrequencyEngine;
45 
46 
47  // <summary>
48  // Engine for TaQL UDF Doppler 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  // DopplerEngine defines Engines (user defined functions) that can be used
63  // in TaQL to convert Measures for dopplers.
64  // In this way such derived values appear to be ordinary TaQL functions.
65  //
66  // Doppler 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 dopplers 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  // Dopplers can be given like:
87  // [v1,v2,...], fromRef
88  // where fromRef is the reference type.
89  //
90  // A doppler can also be a table column which usually knows its type.
91  // It can also be an expression (e.g. DOPPLER[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 DopplerEngine: public MeasEngine<MDoppler>
99  {
100  public:
102 
104  {}
105 
106  virtual ~DopplerEngine();
107 
108  // Handle a possible rest frequency.
109  // False is returned if it appears to be no rest frequency.
111 
112  // Get the values.
114 
115  // Get the dopplers.
117 
118  // Handle the argument(s) giving the input dopplers and reference type.
119  // The doppler can be a column in a table.
120  // If 'proper' is True, it is tested if a proper doppler is given
121  // (with proper type). If not. False is returned.
122  // The 'allow' arguments tell if the doppler can be specified by means of
123  // a radial velocity or freq/restfreq.
124  void handleDoppler (std::vector<TENShPtr>& args,
125  uInt& argnr, Bool allowRadVel, Bool allowFreq);
126 
127  // Set the MeasConvert object.
129 
130  private:
131  void handleRestFreq (vector<TENShPtr>& args, uInt& argnr);
132  void handleLine (const TENShPtr& operand);
133  // Handle the values.
134  virtual void handleValues (TableExprNode& operand,
135  const TableExprId& id,
136  Array<MDoppler>& dopplers);
138 
139  //# Data members.
142  std::shared_ptr<RadialVelocityEngine> itsRadVelEngine;
143  std::shared_ptr<FrequencyEngine > itsFreqEngine;
146  };
147 
148 } //end namespace
149 
150 #endif
Array< MDoppler > getDopplers(const TableExprId &id)
Get the dopplers.
std::shared_ptr< FrequencyEngine > itsFreqEngine
Array< MVFrequency > itsConstRestFreqs
void handleRestFreq(vector< TENShPtr > &args, uInt &argnr)
std::shared_ptr< RadialVelocityEngine > itsRadVelEngine
void handleLine(const TENShPtr &operand)
void setConverter(MDoppler::Types toType)
Set the MeasConvert object.
Bool handleRestFreq(const TENShPtr &)
Handle a possible rest frequency.
void handleDoppler(std::vector< TENShPtr > &args, uInt &argnr, Bool allowRadVel, Bool allowFreq)
Handle the argument(s) giving the input dopplers and reference type.
virtual void handleValues(TableExprNode &operand, const TableExprId &id, Array< MDoppler > &dopplers)
Handle the values.
Array< MVFrequency > getRestFreqs(const TableExprId &id)
MDoppler::Convert itsConverter
Array< Double > getArrayDouble(const TableExprId &id)
Get the values.
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
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