casacore
Loading...
Searching...
No Matches
MSDerivedValues.h
Go to the documentation of this file.
1// # MSDerivedValues.h: a server for values derived from a MS (e.g. P.A.)
2// # Copyright (C) 1997,1999,2000
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 MS_MSDERIVEDVALUES_H
27#define MS_MSDERIVEDVALUES_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/Vector.h>
31#include <casacore/measures/Measures.h>
32#include <casacore/measures/Measures/MCDirection.h>
33#include <casacore/measures/Measures/MDoppler.h>
34#include <casacore/measures/Measures/MFrequency.h>
35#include <casacore/measures/Measures/MCEpoch.h>
36#include <casacore/measures/Measures/MCRadialVelocity.h>
37#include <casacore/measures/Measures/MPosition.h>
38#include <casacore/ms/MeasurementSets/MeasurementSet.h>
39namespace casacore { // # NAMESPACE CASACORE - BEGIN
40
41// # Forward Declarations
43class String;
44// <summary>
45// MSDerivedValues calculates values derived from a MS
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
51// </reviewed>
52
53// <prerequisite>
54// <li> MeasurementSet
55// <li> SomeOtherClass
56// <li> some concept
57// </prerequisite>
58//
59// <etymology>
60// MSDerivedValues calculates values derived from those in a MS
61// </etymology>
62//
63// <synopsis>
64// MSDerivedValues is a class that computes values derived from those present
65// in a MeasurementSet. E.g., calculate feed position angles on the sky from
66// time, antenna positions and feed characteristics.
67// </synopsis>
68//
69// <example>
70// <srcblock>
71// // calculate the parallactic angle and the observatory velocity for the
72// // first time and first source in the MS.
73// // set up
74// MSDerivedValues msd;
75// MS myMS("myMS");
76// MSColumns msc(myMS);
77// msd.setAntennas(msc.antenna());
78// MEpoch ep=MS::epochMeasure(msc.time());
79// ep.set(MVEpoch(Quantity(msc.time()(0),"s")));
80// msd.setEpoch(ep);
81// MDirection dir=MS::directionMeasure(msc.field().phaseDir());
82// dir.set(MVDirection(Vector<Double>(msc.field().phaseDir()(0))));
83// msd.setFieldCenter(dir);
84// msd.setVelocityFrame(MRadialVelocity::LSRK);
85// // now we are ready for the calculations:
86// Double parAngle = msd.parangle();
87// MRadialVelocity observatoryVel = msd.obsVel();
88// </srcblock>
89// </example>
90//
91// <motivation>
92// Values derived from those in a MS are needed in various places, e.g., for
93// plotting purposes. This class combines the commonly needed calculations
94// in one place.
95// </motivation>
96//
97// <thrown>
98// <li>
99// <li>
100// </thrown>
101//
102// <todo asof="1997/05/30">
103// <li> the interface should be less cumbersome
104// <li> probably needs speeding up
105// </todo>
106
108 friend class VisBufferAsync; // to work around dysfunctional operator= and
109 // thread-hostile shared pointers (Jim Jacobs 111104)
110 public:
113
114 // Copy constructor, this will initialize with other's MS
116
117 // Assignment, this will initialize with other's MS
119
120 // Set antenna position from an antenna table
121 // Returns the number of antennas. Also
122 // sets the observatory position to the average of the antenna positions.
124
125 // Set antenna positions, index in vector is antenna number
126 // for calls below.
129
130 // Set the observatory position. Note that setAntennas will reset this.
132
133 // Set antenna mounts, should have same number of entries as
134 // antPosition in setAntennaPosition
136
137 // Set epoch
139
140 // Set field center
142
143 // If you have used setMeasurementSet then this version of
144 // setFieldCenter using field id makes sense
146
147 // Set antenna index, sets the position reference for the conversions.
148 // Use -1 to set the reference frame to the observatory position.
150
151 // Set the velocity frame type (e.g., MRadialVelocity::LSRK)
153
154 // Set the velocity frame type (e.g., MRDoppler::RADIO)
157
158 // Set the frequency frame (e.g., MFrequency::LSRK)
160
161 // get hour angle
163
164 // get parallactic angle
166
167 // get azimuth & elevation
168 const MDirection& azel();
169
170 // get LAST for given time, antenna
171 const MEpoch& last();
172
173 // get observatory radial velocity for given epoch, position and direction
175
176 // Set an ms does not need to explicity setAntennas and is necessary if
177 // setRestFreqency(fieldid, spwid) is used
179
180 // Set restFrequencies...make it look for it for the fieldid, spwid and line
181 // number defined in the SOURCE table return False if it fails to find the
182 // restFrquency
183 Bool setRestFrequency(const Int fieldid, const Int spwid, const Int linenum = 0);
184
185 //
187
188 // get frequency from velocity
189
190 Quantity toFrequency(const Quantity& vel, const Quantity& restFreq);
192
193 // get velocity from frequency
194 Quantity toVelocity(const Quantity& freq, const Quantity& restFreq);
196
197 protected:
198 private:
199 // initialize data
200 void init();
201
221
222 // Vector<Double> receptorAngle_p;
223};
224
225} // namespace casacore
226
227#endif
MeasConvert< MDirection > Convert
Measure Convert (i.e.
Definition MDirection.h:244
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition MDoppler.h:149
MeasRef< MDoppler > Ref
Measure reference (i.e.
Definition MDoppler.h:167
MeasConvert< MEpoch > Convert
Measure Convert (i.e.
Definition MEpoch.h:157
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:175
MeasRef< MFrequency > Ref
Measure reference (i.e.
Definition MFrequency.h:202
MeasConvert< MRadialVelocity > Convert
Measure conversion use (i.e.
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
MSDerivedValues & setVelocityReference(MDoppler::Types dopType)
Set the velocity frame type (e.g., MRDoppler::RADIO).
Double hourAngle()
get hour angle
MSDerivedValues & setAntennaMount(const Vector< String > &mount)
Set antenna mounts, should have same number of entries as antPosition in setAntennaPosition.
MSDerivedValues & operator=(const MSDerivedValues &other)
Assignment, this will initialize with other's MS.
MDirection::Convert cRADecToAzEl_p
MSDerivedValues & setFieldCenter(uInt fieldid=0)
If you have used setMeasurementSet then this version of setFieldCenter using field id makes sense.
MSDerivedValues()
thread-hostile shared pointers (Jim Jacobs 111104)
const MEpoch & last()
get LAST for given time, antenna
MRadialVelocity::Types getRadialVelocityType() const
Double parAngle()
get parallactic angle
void init()
initialize data
MSDerivedValues & setRestFrequency(const Quantity &restFreq)
const MRadialVelocity & obsVel()
get observatory radial velocity for given epoch, position and direction
MDirection::Convert cHADecToAzEl_p
Quantity toVelocity(const Quantity &freq)
Quantity toVelocity(const Quantity &freq, const Quantity &restFreq)
get velocity from frequency
MRadialVelocity::Convert cTOPOToLSR_p
MSDerivedValues & setAntenna(Int antenna)
Set antenna index, sets the position reference for the conversions.
MDirection::Convert cRADecToHADec_p
MSDerivedValues & setVelocityFrame(MRadialVelocity::Types vType)
Set the velocity frame type (e.g., MRadialVelocity::LSRK).
Vector< MPosition > mAntPos_p
Quantity toFrequency(const Quantity &vel)
MSDerivedValues & setAntennaPositions(const Vector< MPosition > &antPosition)
Set antenna positions, index in vector is antenna number for calls below.
const Vector< MPosition > & getAntennaPositions() const
const MDirection & azel()
get azimuth & elevation
MSDerivedValues & setEpoch(const MEpoch &time)
Set epoch.
MRadialVelocity::Types radialVelocityType_p
Quantity toFrequency(const Quantity &vel, const Quantity &restFreq)
get frequency from velocity
MSDerivedValues & setFieldCenter(const MDirection &fieldCenter)
Set field center.
MSDerivedValues & setMeasurementSet(const MeasurementSet &ms)
Set an ms does not need to explicity setAntennas and is necessary if setRestFreqency(fieldid,...
Bool setRestFrequency(const Int fieldid, const Int spwid, const Int linenum=0)
Set restFrequencies...make it look for it for the fieldid, spwid and line number defined in the SOURC...
MSDerivedValues(const MSDerivedValues &other)
Copy constructor, this will initialize with other's MS.
MSDerivedValues & setFrequencyReference(MFrequency::Types frqType)
Set the frequency frame (e.g., MFrequency::LSRK).
Int setAntennas(const MSAntennaColumns &ac)
Set antenna position from an antenna table Returns the number of antennas.
MSDerivedValues & setObservatoryPosition(const MPosition &obsPosition)
Set the observatory position.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1368
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53