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