casacore
FrequencyEngine.h
Go to the documentation of this file.
1 //# FrequencyEngine.h: Engine for TaQL UDF 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_FREQUENCYENGINE_H
29 #define MEAS_FREQUENCYENGINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include<casacore/meas/MeasUDF/MeasEngine.h>
34 #include <casacore/measures/Measures/MFrequency.h>
35 #include <casacore/measures/Measures/MCFrequency.h>
36 #include <casacore/measures/Measures/MeasConvert.h>
37 
38 namespace casacore {
39 
40  //# Forward declarations
41  class DopplerEngine;
42  class RadialVelocityEngine;
43  class DirectionEngine;
44  class EpochEngine;
45  class PositionEngine;
46 
47 
48  // <summary>
49  // Engine for TaQL UDF Frequency conversions
50  // </summary>
51 
52  // <use visibility=export>
53 
54  // <reviewed reviewer="" date="" tests="tMeas.cc">
55  // </reviewed>
56 
57  // <prerequisite>
58  //# Classes you should understand before using this one.
59  // <li> EngineBase
60  // </prerequisite>
61 
62  // <synopsis>
63  // FrequencyEngine defines Engines (user defined functions) that can be used
64  // in TaQL to convert Measures for frequencies.
65  // In this way such derived values appear to be ordinary TaQL functions.
66  //
67  // Frequency conversions require a MeasFrame containing sky direction,
68  // epoch and position on earth.
69  // In TaQL these functions can be called like:
70  // <srcblock>
71  // meas.freq ('TOPO', 1GHz, 'LSRK', 'CasA', date(),
72  // [1e6m,1e6m,1e6m], 'WGS84')
73  // </srcblock>
74  // which converts the frequency from LSRK to TOPO.
75  // <ul>
76  // <li>
77  // <src>toref</src> is a single constant string.
78  // <li>
79  // <src>pos</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 such functions return data with type double and unit Hz.
86  //
87  // Frequencies can be given like:
88  // [f1,f2,...], fromRef
89  // where fromRef is the reference type.
90  //
91  // A frequency can also be a table column which usually knows its type.
92  // It can also be an expression (e.g. FREQUENCY[0,]) which also knows the type.
93  // </synopsis>
94 
95  // <motivation>
96  // It makes it possible to handle measures in TaQL.
97  // </motivation>
98 
99  class FrequencyEngine: public MeasEngine<MFrequency>
100  {
101  public:
103 
104  virtual ~FrequencyEngine();
105 
106  // Get the values.
107  Array<Double> getArrayDouble (const TableExprId& id, int type);
108 
109  // Get the frequencies.
111 
112  // Handle the argument(s) giving the input frequencies and reference type.
113  // The frequency can be a column in a table.
114  void handleFrequency (std::vector<TENShPtr>& args,
115  uInt& argnr);
116 
117  // Set the MeasConvert object.
119 
120  // Set the possible doppler engine.
121  // It can be done only once.
123 
124  // Set the possible radial velocity engine.
125  // It can be done only once.
127 
128  // Set the possible direction engine.
129  // It can be done only once.
131 
132  // Set the possible epoch engine.
133  // It can be done only once.
134  void setEpochEngine (EpochEngine& engine);
135 
136  // Set the possible position engine.
137  // It can be done only once.
139 
140  private:
141  virtual void handleValues (TableExprNode& operand,
142  const TableExprId& id,
143  Array<MFrequency>& frequencies);
144 
145  //# Data members.
146  MeasFrame itsFrame; //# frame used by converter
147  MeasFrame itsRVFrame; //# frame used for radial velocities
154  };
155 
156 } //end namespace
157 
158 #endif
Array< Double > getArrayDouble(const TableExprId &id, int type)
Get the values.
void setPositionEngine(PositionEngine &engine)
Set the possible position engine.
void setDirectionEngine(DirectionEngine &engine)
Set the possible direction engine.
void setConverter(MFrequency::Types toType)
Set the MeasConvert object.
Array< MFrequency > getFrequencies(const TableExprId &id)
Get the frequencies.
virtual void handleValues(TableExprNode &operand, const TableExprId &id, Array< MFrequency > &frequencies)
Let a derive class handle the values.
void handleFrequency(std::vector< TENShPtr > &args, uInt &argnr)
Handle the argument(s) giving the input frequencies and reference type.
DirectionEngine * itsDirectionEngine
MFrequency::Convert itsConverter
void setDopplerEngine(DopplerEngine &engine)
Set the possible doppler engine.
RadialVelocityEngine * itsRadVelEngine
void setRadVelEngine(RadialVelocityEngine &engine)
Set the possible radial velocity engine.
PositionEngine * itsPositionEngine
DopplerEngine * itsDopplerEngine
void setEpochEngine(EpochEngine &engine)
Set the possible epoch engine.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51