casacore
Loading...
Searching...
No Matches
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: 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_DOPPLERENGINE_H
27#define MEAS_DOPPLERENGINE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/meas/MeasUDF/MeasEngine.h>
32#include <casacore/measures/Measures/MDoppler.h>
33#include <casacore/measures/Measures/MCDoppler.h>
34#include <casacore/measures/Measures/MeasConvert.h>
35#include <casacore/casa/Quanta/MVFrequency.h>
36#include <memory>
37
38namespace casacore {
39
40// # Forward Declarations
42class FrequencyEngine;
43
44// <summary>
45// Engine for TaQL UDF Doppler conversions
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="" date="" tests="tMeas.cc">
51// </reviewed>
52
53// <prerequisite>
54// # Classes you should understand before using this one.
55// <li> EngineBase
56// </prerequisite>
57
58// <synopsis>
59// DopplerEngine defines Engines (user defined functions) that can be used
60// in TaQL to convert Measures for dopplers.
61// In this way such derived values appear to be ordinary TaQL functions.
62//
63// Doppler conversions require a MeasFrame containing sky direction,
64// epoch and position on earth.
65// In TaQL these functions can be called like:
66// <srcblock>
67// meas.rv ('TOPO', 1 'm/s', 'LSRK', 'CasA', date(),
68// [1e6m,1e6m,1e6m], 'WGS84')
69// </srcblock>
70// which converts the dopplers from LSRK to TOPO.
71// <ul>
72// <li>
73// <src>toref</src> is a single constant string.
74// <li>
75// <src>pos</src> can have various value types. A single numeric array is
76// a series of RA,DEC in J2000. If given as a set, the last argument of the
77// set can be the reference types of the values in the set. The values can
78// be strings (indicating planetary objects) or value pairs giving lon,lat.
79// The default reference type is J2000.
80// </ul>
81// All such functions return data with type double and unit Hz.
82//
83// Dopplers can be given like:
84// [v1,v2,...], fromRef
85// where fromRef is the reference type.
86//
87// A doppler can also be a table column which usually knows its type.
88// It can also be an expression (e.g. DOPPLER[0,]) which also knows the type.
89// </synopsis>
90
91// <motivation>
92// It makes it possible to handle measures in TaQL.
93// </motivation>
94
95class DopplerEngine : public MeasEngine<MDoppler> {
96 public:
97 enum Type { DOPPLER, FREQ, RADVEL };
98
100
101 virtual ~DopplerEngine();
102
103 // Handle a possible rest frequency.
104 // False is returned if it appears to be no rest frequency.
106
107 // Get the values.
109
110 // Get the dopplers.
112
113 // Handle the argument(s) giving the input dopplers and reference type.
114 // The doppler can be a column in a table.
115 // If 'proper' is True, it is tested if a proper doppler is given
116 // (with proper type). If not. False is returned.
117 // The 'allow' arguments tell if the doppler can be specified by means of
118 // a radial velocity or freq/restfreq.
119 void handleDoppler(std::vector<TENShPtr>& args, uInt& argnr, Bool allowRadVel, Bool allowFreq);
120
121 // Set the MeasConvert object.
123
124 private:
125 void handleRestFreq(vector<TENShPtr>& args, uInt& argnr);
126 void handleLine(const TENShPtr& operand);
127 // Handle the values.
128 virtual void handleValues(TableExprNode& operand, const TableExprId& id,
129 Array<MDoppler>& dopplers);
131
132 // # Data members.
135 std::shared_ptr<RadialVelocityEngine> itsRadVelEngine;
136 std::shared_ptr<FrequencyEngine> itsFreqEngine;
139};
140
141} // namespace casacore
142
143#endif
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.
Array< MDoppler > getDopplers(const TableExprId &id)
Get the dopplers.
virtual void handleValues(TableExprNode &operand, const TableExprId &id, Array< MDoppler > &dopplers)
Handle the values.
MDoppler::Convert itsConverter
Array< MVFrequency > getRestFreqs(const TableExprId &id)
Array< Double > getArrayDouble(const TableExprId &id)
Get the values.
MeasConvert< MDoppler > Convert
Measure Convert (i.e.
Definition MDoppler.h:169
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition MDoppler.h:149
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
std::shared_ptr< TableExprNodeRep > TENShPtr
Definition ExprNodeRep.h:56
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40