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
42class MSAntennaColumns;
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{
109 friend class VisBufferAsync; // to work around dysfunctional operator= and
110 // thread-hostile shared pointers (Jim Jacobs 111104)
111public:
114
115 // Copy constructor, this will initialize with other's MS
117
118 // Assignment, this will initialize with other's MS
120
121 // Set antenna position from an antenna table
122 // Returns the number of antennas. Also
123 // sets the observatory position to the average of the antenna positions.
125
126 // Set antenna positions, index in vector is antenna number
127 // for calls below.
130
131 // Set the observatory position. Note that setAntennas will reset this.
133
134 // Set antenna mounts, should have same number of entries as
135 // antPosition in setAntennaPosition
137
138 // Set epoch
140
141 // Set field center
143
144 //If you have used setMeasurementSet then this version of
145 //setFieldCenter using field id makes sense
147
148 // Set antenna index, sets the position reference for the conversions.
149 // Use -1 to set the reference frame to the observatory position.
151
152 // Set the velocity frame type (e.g., MRadialVelocity::LSRK)
154
155 // Set the velocity frame type (e.g., MRDoppler::RADIO)
158
159 // Set the frequency frame (e.g., MFrequency::LSRK)
161
162 // get hour angle
164
165 // get parallactic angle
167
168 // get azimuth & elevation
169 const MDirection& azel();
170
171 // get LAST for given time, antenna
172 const MEpoch& last();
173
174 // get observatory radial velocity for given epoch, position and direction
176
177 //Set an ms does not need to explicity setAntennas and is necessary if
178 //setRestFreqency(fieldid, spwid) is used
180
181
182 //Set restFrequencies...make it look for it for the fieldid, spwid and line
183 //number defined in the SOURCE table return False if it fails to find the
184 //restFrquency
185 Bool setRestFrequency(const Int fieldid, const Int spwid,
186 const Int linenum=0);
187
188 //
190
191
192 // get frequency from velocity
193
194 Quantity toFrequency(const Quantity& vel, const Quantity& restFreq);
196
197 // get velocity from frequency
198 Quantity toVelocity(const Quantity& freq, const Quantity& restFreq);
200
201protected:
202
203private:
204
205 // initialize data
206 void init();
207
227
228 // Vector<Double> receptorAngle_p;
229
230
231};
232
233
234} //# NAMESPACE CASACORE - END
235
236#endif
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition MDoppler.h:146
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:173
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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1584
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
double Double
Definition aipstype.h:53