casacore
Loading...
Searching...
No Matches
UVWMachine.h
Go to the documentation of this file.
1//# UVWMachine.h: Converts UVW coordinates between coordinate systems
2//# Copyright (C) 1998,2001
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#ifndef MEASURES_UVWMACHINE_H
26#define MEASURES_UVWMACHINE_H
27
28//# Includes
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/ArrayFwd.h>
31#include <casacore/measures/Measures.h>
32#include <casacore/measures/Measures/MCDirection.h>
33#include <casacore/casa/Quanta/MVPosition.h>
34#include <casacore/casa/Quanta/RotMatrix.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declarations
39class MeasFrame;
40
41// <summary> Converts UVW coordinates between coordinate systems </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tUVWMachine.cc" demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=MDirection>MDirection</linkto> class
50// </prerequisite>
51//
52// <etymology>
53// From UVW coordinates and machinery
54// </etymology>
55//
56// <synopsis>
57// The construction of a UVWMachine class object creates a machine that can
58// convert UVW coordinates from one coordinate system to another. In addition
59// it can also supply the phase rotation necessary to move to a new position.
60//
61// The constructors need an input
62// <linkto class=MDirection>MDirection</linkto> to specify the input UVW
63// coordinates reference direction and coordinate system.
64// An EW flag can be specified to indicate the different type of UVW
65// coordinates. I.e. projection along polar axis rather than towards
66// observing direction (not implemented yet).
67// A project flag, if set, will re-project the resulting UV plane onto the
68// in-direction reference plane.
69//
70// The constructors also need an output coordinate system
71// (<linkto class=MeasRef>MDirection::Ref</linkto>) or an output
72// MDirection (including the reference coordinate system). The first case
73// indicates that the real position on the sky does not change (only the
74// coordinate system used); the second indicates that the UVW should be
75// for a new position on the sky (in addition to maybe a different
76// coordinate system). In the first case only the UVW coordinates will change,
77// in the second the UVW positions will change, but also the phase of the
78// observed data will have to change. For some conversions a reference
79// <linkto class=MeasFrame>frame</linkto> is needed (to indicate e.g. the
80// position or time). This frame can be part of one of the constructor
81// references, but can also be specified separately in the constructor. A
82// change in the frame parameter can be made outside the UVWMachine
83// by e.g. <em>frame.reset(anMEpoch)</em>.
84// <note role=caution>
85// If the frame is changed by the user of the conversion machine, the
86// machine has to be reinitialised before using it for output by using
87// <tt>reCalculate()</tt>.
88//
89// Projection entails a rotation. For changes to a fixed frame (i.e. not
90// changing with e.g. time), the rotation matrix is calculated only once. In
91// other cases it has to be calculated per series of uvw conversions. The
92// latter case can hence be time consuming.
93// </note>
94// <note role=tip>
95// If either the input or output direction/reference specifies a planet, action
96// is special. Planets are assumed to be in J2000 positions, since that is
97// the only way to carry them from conversion to conversion (and also have a
98// variable phase-center; which can, btw, always be obtained by the
99// phaseCenter() member).</note>
100// Note that a reCalculate() is necessary between calls of the engine,
101// since the planetary position will change from time to time (i.e. with
102// the Frame).
103//
104// If no explicit output coordinate is given (i.e. no phase shift necessary),
105// and the conversion from input to output is an essential NOP, and no
106// reprojection to the input plane is required, the machine will bypass all
107// calculations. This state can be inspected by the <src>isNOP()</src> method.
108//
109// If you want to convert to say an azimuth/elevation map of the Sun, this
110// can be done to have either two conversion engines (original to Sun, then
111// Sun to AzEl), or by conversion of the Sun to AzEl before entering the
112// engine.
113// <note role=tip>
114// The output of the machine is either a set of rotation matrices that can
115// be used to convert UVW coordinates (and, if necessary, phases); or the
116// UVW conversion and actual phase can be calculated from a given
117// UVW coordinate (or set of coordinates).
118// </note>
119// <note role=tip> Since e.g. in an EW interferometer (or any set of baselines
120// on a line) the phase correction and UVW transform scales with the length
121// of the baseline, conversion of a nominal (say 1m) baseline suffices to
122// easily calculate others. The same is true for baselines in a plane,
123// where a conversion of two orthogonal baselines in that plane will suffice.
124// </note>
125// </synopsis>
126//
127// <example>
128// <srcblock>
129// // Given a current phase stopping Center
130// MDirection indir(Quantity(3.25745692, "rad"),
131// Quantity(0.040643336,"rad"),
132// MDirection::Ref(MDirection::B1950));
133// // Conversion to J2000 is set by:
134// UVWMachine uvm(MDirection::Ref(MDirection::J2000), indir);
135// // The rotation matrix to go to new UVW is obtained by:
136// RotMatrix rm(uvm.rotationUVM());
137// // If an UVW specified:
138// MVPosition uvw(-739.048461, -1939.10604, 1168.62562);
139// // This can be converted by e.g.:
140// uvw *= rm;
141// // Or, alternatively, by e.g.:
142// uvm.convertUVW(uvw);
143// </srcblock>
144// </example>
145//
146// <motivation>
147// To aid making maps in different coordinate systems
148// </motivation>
149//
150// <todo asof="1998/01/21">
151// <li> add EW UVW coordinates
152// <li> check if non right-handed coordinates systems (like AzEl) are
153// handled correctly
154// <li> provide a MVuvw and Muvw class to cater for second order effects
155// appropiately
156// </todo>
157
159 public:
160 //# Constructors
161 // Constructors have an EW flag, which will give a projection parallel to
162 // the polar axis rather than in the direction of the fieldcenter, and a
163 // project flag. The last will correct the UV coordinates to re-project
164 // them onto the plane specified by the in direction
165 // <group>
166 // Construct a UVW conversion machine from the in coordinate and its
167 // system to the out coordinate system (output absolute direction
168 // remains the same)
169 UVWMachine(const MDirection::Ref &out, const MDirection &in,
170 Bool EW=False, Bool project=False);
171 // Construct a UVW conversion machine from the in coordinate and its
172 // system to the out coordinate and its system
173 UVWMachine(const MDirection &out, const MDirection &in,
174 Bool EW=False, Bool project=False);
175 // Construct UVW conversion machine with an explicitly given frame
176 // <group>
177 UVWMachine(const MDirection::Ref &out, const MDirection &in,
178 const MeasFrame &frame, Bool EW=False, Bool project=False);
179 UVWMachine(const MDirection &out, const MDirection &in,
180 const MeasFrame &frame, Bool EW=False, Bool project=False);
181 // </group>
182 // </group>
183 // Copy constructor
184 UVWMachine(const UVWMachine &other);
185 // Copy assignments
187
188 //# Destructor
190
191 //# Operators
192 // Return converted UVW coordinates
193 // <group>
198 // </group>
199
200 //# Member functions
201 // Return the new phase center coordinates
202 const MDirection &phaseCenter() const;
203 // Return if the engine is an effective NOP
204 Bool isNOP() { return nop_p; }
205 // Return a rotation matrix that can be used to convert UVW coordinates:
206 // UVW(new) = UVW(old) * rotationUVW()
207 const RotMatrix &rotationUVW() const;
208 // Return a position vector that can produce the phase correction:
209 // dPhase = rotationPhase * UVW(new)
210 const MVPosition &rotationPhase() const;
211 // replace UVW with converted values
212 // <group>
213 void convertUVW(Vector<Double> &uv) const;
215 void convertUVW(MVPosition &uv) const;
217 // </group>
218 // Get phase shift (in implied units of UVW), and change input uvw as well
219 // <group>
224 // </group>
225 // Replace UVW with converted, and return phase
226 // <group>
231 // </group>
232
233 // Recalculate the parameters for the machine after e.g. a frame change
235
236 private:
237
238 //# Data
239 // EW flag
241 // Projection flag
243 // Zero phase flag (for speed)
245 // No conversion necessary flag
247 // Old phase center
249 // New coordinate reference
251 // Old phase center in new coordinates
253 // New phase center
255 // Rotation Matrix to go from input UVW to coordinate system
257 // Rotation matrix to go from old system to new system
259 // Rotation Matrix to go from new coordinate system to output UVW
261 // Rotation Matrix to project UV-plane onto
263 // UVW rotation
265 // UVW rotation including projection
267 // Phase rotation
269 // Conversion engine
271
272 //# Constructors
273 // default constructor: not implemented
275
276 //# Private Member Functions
277 // Initialise machinery
278 void init();
279 // Planet handling
281 // Copy data members
282 void copy(const UVWMachine &other);
283};
284
285
286} //# NAMESPACE CASACORE - END
287
288#endif
289
290
UVWMachine(const MDirection &out, const MDirection &in, Bool EW=False, Bool project=False)
Construct a UVW conversion machine from the in coordinate and its system to the out coordinate and it...
UVWMachine(const UVWMachine &other)
Copy constructor.
RotMatrix rot4_p
Rotation Matrix to project UV-plane onto.
Definition UVWMachine.h:262
MVPosition operator()(const MVPosition &uv) const
Vector< Vector< Double > > operator()(const Vector< Vector< Double > > &uv) const
void convertUVW(Vector< MVPosition > &uv) const
RotMatrix uvrot_p
UVW rotation.
Definition UVWMachine.h:264
const RotMatrix & rotationUVW() const
Return a rotation matrix that can be used to convert UVW coordinates: UVW(new) = UVW(old) * rotationU...
Vector< Double > operator()(const Vector< Double > &uv) const
Return converted UVW coordinates.
MVPosition phrot_p
Phase rotation.
Definition UVWMachine.h:268
void convertUVW(Double &phase, Vector< Double > &uv) const
Replace UVW with converted, and return phase.
void planetinit()
Planet handling.
Double getPhase(Vector< Double > &uv) const
Get phase shift (in implied units of UVW), and change input uvw as well.
void convertUVW(Vector< Vector< Double > > &uv) const
RotMatrix rot3_p
Rotation Matrix to go from new coordinate system to output UVW.
Definition UVWMachine.h:260
MDirection outin_p
Old phase center in new coordinates.
Definition UVWMachine.h:252
void convertUVW(Double &phase, MVPosition &uv) const
Vector< Double > getPhase(Vector< Vector< Double > > &uv) const
UVWMachine & operator=(const UVWMachine &other)
Copy assignments.
Vector< Double > getPhase(Vector< MVPosition > &uv) const
UVWMachine(const MDirection::Ref &out, const MDirection &in, const MeasFrame &frame, Bool EW=False, Bool project=False)
Construct UVW conversion machine with an explicitly given frame.
Bool proj_p
Projection flag.
Definition UVWMachine.h:242
UVWMachine(const MDirection &out, const MDirection &in, const MeasFrame &frame, Bool EW=False, Bool project=False)
RotMatrix rot1_p
Rotation Matrix to go from input UVW to coordinate system.
Definition UVWMachine.h:256
Bool ew_p
EW flag.
Definition UVWMachine.h:240
void convertUVW(Vector< Double > &phase, Vector< MVPosition > &uv) const
MDirection::Ref outref_p
New coordinate reference.
Definition UVWMachine.h:250
Vector< MVPosition > operator()(const Vector< MVPosition > &uv) const
Bool isNOP()
Return if the engine is an effective NOP.
Definition UVWMachine.h:204
void init()
Initialise machinery.
void convertUVW(Vector< Double > &uv) const
replace UVW with converted values
void convertUVW(MVPosition &uv) const
Bool nop_p
No conversion necessary flag.
Definition UVWMachine.h:246
void convertUVW(Vector< Double > &phase, Vector< Vector< Double > > &uv) const
Bool zp_p
Zero phase flag (for speed)
Definition UVWMachine.h:244
Double getPhase(MVPosition &uv) const
MDirection in_p
Old phase center.
Definition UVWMachine.h:248
MDirection out_p
New phase center.
Definition UVWMachine.h:254
void reCalculate()
Recalculate the parameters for the machine after e.g.
const MVPosition & rotationPhase() const
Return a position vector that can produce the phase correction: dPhase = rotationPhase * UVW(new)
void copy(const UVWMachine &other)
Copy data members.
UVWMachine()
default constructor: not implemented
const MDirection & phaseCenter() const
Return the new phase center coordinates.
MDirection::Convert conv_p
Conversion engine.
Definition UVWMachine.h:270
RotMatrix rot2_p
Rotation matrix to go from old system to new system.
Definition UVWMachine.h:258
UVWMachine(const MDirection::Ref &out, const MDirection &in, Bool EW=False, Bool project=False)
Constructors have an EW flag, which will give a projection parallel to the polar axis rather than in ...
RotMatrix uvproj_p
UVW rotation including projection.
Definition UVWMachine.h:266
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition ExprNode.h:1452
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53