casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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:
115  MSDerivedValues();
117 
118  // Copy constructor, this will initialize with other's MS
119  MSDerivedValues(const MSDerivedValues& other);
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.
127  Int setAntennas(const MSAntennaColumns& ac);
128 
129  // Set antenna positions, index in vector is antenna number
130  // for calls below.
132  const Vector<MPosition> & getAntennaPositions () const;
133 
134  // Set the observatory position. Note that setAntennas will reset this.
135  MSDerivedValues& setObservatoryPosition(const MPosition& obsPosition);
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
145  MSDerivedValues& setFieldCenter(const MDirection& fieldCenter);
146 
147  //If you have used setMeasurementSet then this version of
148  //setFieldCenter using field id makes sense
149  MSDerivedValues& setFieldCenter(uInt fieldid=0);
150 
151  // Set antenna index, sets the position reference for the conversions.
152  // Use -1 to set the reference frame to the observatory position.
153  MSDerivedValues& setAntenna(Int antenna);
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
166  Double hourAngle();
167 
168  // get parallactic angle
169  Double parAngle();
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
178  const MRadialVelocity& obsVel();
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  //
192  MSDerivedValues& setRestFrequency(const Quantity& restFreq);
193 
194 
195  // get frequency from velocity
196 
197  Quantity toFrequency(const Quantity& vel, const Quantity& restFreq);
198  Quantity toFrequency(const Quantity& vel);
199 
200  // get velocity from frequency
201  Quantity toVelocity(const Quantity& freq, const Quantity& restFreq);
202  Quantity toVelocity(const Quantity& freq);
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
Double hourAngle()
get hour angle
Quantity toVelocity(const Quantity &freq, const Quantity &restFreq)
get velocity from frequency
A Measure: astronomical direction.
Definition: MDirection.h:174
A 1-D Specialization of the Array class.
Definition: ArrayFwd.h:9
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
MRadialVelocity::Types getRadialVelocityType() const
MSDerivedValues calculates values derived from a MS.
MSDerivedValues & setAntennaPositions(const Vector< MPosition > &antPosition)
Set antenna positions, index in vector is antenna number for calls below.
MRadialVelocity::Convert cTOPOToLSR_p
MSDerivedValues & setObservatoryPosition(const MPosition &obsPosition)
Set the observatory position.
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1580
MSDerivedValues & setAntennaMount(const Vector< String > &mount)
Set antenna mounts, should have same number of entries as antPosition in setAntennaPosition.
Double parAngle()
get parallactic angle
Container for Measure frame.
Definition: MeasFrame.h:137
A Measure: radial velocity.
A Measure: instant in time.
Definition: MEpoch.h:104
MSDerivedValues & setFrequencyReference(MFrequency::Types frqType)
Set the frequency frame (e.g., MFrequency::LSRK)
MSDerivedValues & setVelocityReference(MDoppler::Types dopType)
Set the velocity frame type (e.g., MRDoppler::RADIO)
MSDerivedValues & setAntenna(Int antenna)
Set antenna index, sets the position reference for the conversions.
Int setAntennas(const MSAntennaColumns &ac)
Set antenna position from an antenna table Returns the number of antennas.
MEpoch::Convert cUTCToLAST_p
MSDerivedValues()
thread-hostile shared pointers (Jim Jacobs 111104)
double Double
Definition: aipstype.h:55
void init()
initialize data
const Vector< MPosition > & getAntennaPositions() const
MDirection::Convert cRADecToAzEl_p
A class to provide easy access to MSAntenna columns.
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
MSDerivedValues & setFieldCenter(const MDirection &fieldCenter)
Set field center.
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
A Table intended to hold astronomical data (a set of Measurements).
const MEpoch & last()
get LAST for given time, antenna
MDirection::Convert cHADecToAzEl_p
MSDerivedValues & operator=(const MSDerivedValues &other)
Assignment, this will initialize with other&#39;s MS.
Vector< MPosition > mAntPos_p
MSDerivedValues & setEpoch(const MEpoch &time)
Set epoch.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
MSDerivedValues & setVelocityFrame(MRadialVelocity::Types vType)
Set the velocity frame type (e.g., MRadialVelocity::LSRK)
const MRadialVelocity & obsVel()
get observatory radial velocity for given epoch, position and direction
MSDerivedValues & setMeasurementSet(const MeasurementSet &ms)
Set an ms does not need to explicity setAntennas and is necessary if setRestFreqency(fieldid, spwid) is used.
Quantity toFrequency(const Quantity &vel, const Quantity &restFreq)
get frequency from velocity
const MDirection & azel()
get azimuth &amp; elevation
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...
MDirection::Convert cRADecToHADec_p
unsigned int uInt
Definition: aipstype.h:51
MRadialVelocity::Types radialVelocityType_p