casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MRadialVelocity.h
Go to the documentation of this file.
00001 //# MRadialVelocity.h: A Measure: radial velocity
00002 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: MRadialVelocity.h 21298 2012-12-07 14:53:03Z gervandiepen $
00028 
00029 #ifndef MEASURES_MRADIALVELOCITY_H
00030 #define MEASURES_MRADIALVELOCITY_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <measures/Measures/MeasBase.h>
00035 #include <measures/Measures/MeasRef.h>
00036 #include <casa/Quanta/MVRadialVelocity.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 //# Forward Declarations
00041 class MRadialVelocity;
00042 class MCRadialVelocity;
00043 template <class M> class MeasConvert;
00044 template <class M> class ArrayMeasColumn;
00045 template <class M> class ScalarMeasColumn;
00046 class MDoppler;
00047 class MVDoppler;
00048 
00049 //# Typedefs
00050 
00051 // <summary>
00052 // A Measure: radial velocity
00053 // </summary>
00054 
00055 // <use visibility=export>
00056 
00057 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
00058 // </reviewed>
00059 
00060 // <prerequisite>
00061 //   <li> <linkto class=Measure>Measure</linkto> class 
00062 // </prerequisite>
00063 //
00064 // <etymology>
00065 // </etymology>
00066 //
00067 // <synopsis>
00068 // MRadialVelocity is a derived Measure class for radial velocity.<br>
00069 // An MRadialVelocity can be generated from a simple value (or an
00070 // <linkto class=MVRadialVelocity>MVRadialVelocity</linkto> object), which is then
00071 // interpreted as a RadialVelocity in m/s, and a reference, with an LSRK type
00072 // as default.<br>
00073 // It can also be generated from a Quantity, where the interpretation
00074 // depends on the dimensionality of the Quantity:
00075 // <ul>
00076 // <li> velocity (e.g. AU/a)
00077 // </ul>
00078 // The different reference types of a RadialVelocity are:
00079 // <ul>
00080 //  <li> MRadialVelocity::LSRD --- Local Standard of Rest (J2000) -- as the
00081 //            dynamical definition (IAU, [9,12,7] km/s in galactic coordinates)
00082 //  <li> MRadialVelocity::LSRK -- LSR as a kinematical (radio) definition --
00083 //              20.0 km/s in direction ra,dec = [270,+30] deg (B1900.0)
00084 //  <li> MRadialVelocity::BARY -- Barycentric (J2000)
00085 //  <li> MRadialVelocity::GEO --- Geocentric
00086 //  <li> MRadialVelocity::TOPO -- Topocentric
00087 //  <li> MRadialVelocity::GALACTO -- Galacto centric (with rotation of 220 km/s
00088 //              in direction l,b = [90,0] deg.
00089 //  <li> MRadialVelocity::LGROUP -- Local group velocity -- 308km/s towards
00090 //               l,b = [105,-7] deg (F. Ghigo)
00091 //  <li> MRadialVelocity::CMB -- CMB velocity -- 369.5km/s towards
00092 //              l,b = [264.4, 48.4] deg (F. Ghigo)
00093 //  <li> MRadialVelocity::DEFAULT = LSRK
00094 // </ul>
00095 // <p>
00096 // Conversion between the different types is done with the standard
00097 // <linkto class=MeasConvert>MeasConvert</linkto> class 
00098 // (<src>MRadialVelocity::Convert</src> in this case).<br>
00099 // Some of the conversions are only possible if frame information has been 
00100 // filled in. The following frame information is necessary if a conversion
00101 // goes to or from the (different) specified types:
00102 // <ul>
00103 //  <li><em>Epoch</em>: TOPO, GEO
00104 //  <li><em>Position</em>: TOPO
00105 //  <li><em>Direction</em> all
00106 // </ul>
00107 // <br>
00108 // <note role=caution> For large radial velocities (of order c) the conversions are
00109 // not precise, and not completely reversable, due to unknown transverse
00110 // velocities, and the additive way in which corrections are done. They
00111 // are correct to first order wrt relativistic effects
00112 // </note>
00113 // An MRadialVelocity can be created from an
00114 // <linkto class=MDoppler>MDoppler</linkto> 
00115 // by the <src>fromDoppler()</src> member. It can be converted to an MDoppler
00116 // with the <src>toDoppler()</src>. Comparable methods are available
00117 // for <linkto class=MFrequency>MFrequency</linkto> as 
00118 // <src>toRadial()</src> and <src>fromRadial</src>.<br>
00119 // </synopsis>
00120 //
00121 // <example>
00122 // Get the Doppler shift for an oberved HI RadialVelocity of 100 km/s
00123 // <srcblock>
00124 //      cout << "Redshift for 100 km/s: " <<
00125 //              MDoppler::Convert( MRadialVelocity( Quantity(100., "km/s"),
00126 //                                    MRadialVelocity::TOPO).toDoppler(),
00127 //                                 MDoppler::Z)() << endl;
00128 // </srcblock>                             
00129 // </example>
00130 //
00131 // <motivation>
00132 // </motivation>
00133 //
00134 // <todo asof="2003/03/03">
00135 // </todo>
00136 
00137 class MRadialVelocity : public MeasBase<MVRadialVelocity, MeasRef<MRadialVelocity> > {
00138 
00139  public:
00140   //# Friends
00141   // Conversion of data
00142   friend class MeasConvert<MRadialVelocity>;
00143   
00144   //# Enumerations
00145   // Types of known MRadialVelocity
00146   // <note role=warning> The order defines the order in the translation
00147   // matrix FromTo
00148   // in the getConvert routine. Do not change the order without
00149   // changing the array. Additions should be made before N_types, and
00150   // an additional row and column should be coded in FromTo, and
00151   // in showType().</note>
00152   enum Types {
00153     LSRK,
00154     LSRD,
00155     BARY,
00156     GEO,
00157     TOPO,
00158     GALACTO,
00159     LGROUP,
00160     CMB,
00161     N_Types,
00162     // Defaults
00163     DEFAULT=LSRK,
00164     // Synonyms
00165     LSR=LSRK };
00166   
00167   //# Typedefs
00168   // Measure value container for this class (i.e. MRadialVelocity::MVType)
00169   typedef MVRadialVelocity MVType;
00170   // Measure conversion routines for this class (i.e. MRadialVelocity::MCType)
00171   typedef MCRadialVelocity MCType;
00172   // Measure reference (i.e. MRadialVelocity::Ref)
00173   typedef MeasRef<MRadialVelocity> Ref;
00174   // Measure conversion use (i.e. MRadialVelocity::Convert)
00175   typedef MeasConvert<MRadialVelocity> Convert;
00176   // Measure table Columns (e.g., MRadialVelocity::ScalarColumn)
00177   typedef ScalarMeasColumn<MRadialVelocity> ScalarColumn;
00178   typedef ArrayMeasColumn<MRadialVelocity> ArrayColumn;
00179   // Reference enum Types (included originally for gcc 2.95)  
00180   typedef WHATEVER_SUN_TYPEDEF(MRadialVelocity) Types Types;
00181   
00182   //# Constructors
00183   // <note role=tip> In the following constructors and other functions, all 
00184   // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
00185   // where no offsets or frames are needed in the reference. </note>
00186   // Default constructor; generates a zero rest RadialVelocity
00187   MRadialVelocity();
00188   // Create from data and reference
00189   // <group>
00190   MRadialVelocity(const MVRadialVelocity &dt);
00191   MRadialVelocity(const MVRadialVelocity &dt, const MRadialVelocity::Ref &rf);
00192   MRadialVelocity(const MVRadialVelocity &dt, MRadialVelocity::Types rf);
00193   MRadialVelocity(const Quantity &dt);
00194   MRadialVelocity(const Quantity &dt, const MRadialVelocity::Ref &rf);
00195   MRadialVelocity(const Quantity &dt, MRadialVelocity::Types rf);
00196   MRadialVelocity(const Measure *dt);
00197   MRadialVelocity(const MeasValue *dt);
00198   // </group>
00199   
00200   //# Destructor
00201   virtual ~MRadialVelocity();
00202   
00203   //# Operators
00204   
00205   //# General Member Functions
00206   // Tell me your type
00207   // <group>
00208   virtual const String &tellMe() const;
00209   static const String &showMe();
00210   virtual uInt type() const;
00211   static void assure(const Measure &in);
00212   // </group>
00213   // Translate reference code. The uInt version has a check for valid codes
00214   // (i.e. it is a safe cast).
00215   // <thrown>
00216   //   <li> AipsError in the uInt interface if illegal code given
00217   // </thrown>
00218   // <group>
00219   static MRadialVelocity::Types castType(uInt tp);
00220   static const String &showType(MRadialVelocity::Types tp);
00221   static const String &showType(uInt tp);
00222   // </group>
00223   // Translate string to reference code
00224   // <group>
00225   static Bool getType(MRadialVelocity::Types &tp, const String &in);
00226   Bool giveMe(MRadialVelocity::Ref &mr, const String &in);
00227   // </group>
00228   // Set the offset in the reference (False if non-matching Measure)
00229   virtual Bool setOffset(const Measure &in);
00230   // Set the reference type to the specified String. False if illegal
00231   // string, reference set to DEFAULT.
00232   virtual Bool setRefString(const String &in);
00233   // Get the default reference type
00234   virtual const String &getDefaultType() const;
00235   // Get a list of all known reference codes. nall returns the number in list,
00236   // nextra the number of specials (like planets) that should be at 
00237   // end of list). typ returns the list of corresponding types.
00238   // <group>
00239   virtual const String* allTypes(Int &nall, Int &nextra,
00240                                  const uInt *&typ) const;
00241   static const String* allMyTypes(Int &nall, Int &nextra,
00242                                   const uInt *&typ);
00243   // </group>
00244   // Check if all internal tables of types (both enum and String) are 
00245   // complete and correct. This function is called automatically if and when
00246   // necessary.
00247   // <thrown>
00248   //   <li> AipsError if a (programming) error in the types.
00249   // </thrown>
00250   // <group> 
00251   virtual void checkTypes() const;
00252   static void checkMyTypes();
00253   // </group>
00254   // Get the reference type (for records, including codes like R_)
00255   virtual String getRefString() const;
00256   // Get my type (as Register)
00257   static uInt myType();
00258   
00259   // Get radial velocity in specified units
00260   Quantity get(const Unit &un) const;
00261   
00262   // Make a Doppler velocity (as an MDoppler::BETA default) from the RadialVelocity.
00263   // <group>
00264   MDoppler toDoppler();
00265   // Local use only
00266   static MDoppler toDoppler(const Measure &in);
00267   // </group>
00268   
00269   // Make a RadialVelocity from the Doppler velocity (assuming LSRK default)
00270   // <group>
00271   static MRadialVelocity fromDoppler(const MDoppler &dop);
00272   static MRadialVelocity fromDoppler(const MDoppler &dop,
00273                                      MRadialVelocity::Types typ);
00274   // For internal use only
00275   static MRadialVelocity fromDoppler(const Measure &dop,
00276                                      MRadialVelocity::Types typ);
00277   // </group>
00278   
00279   // Make a copy
00280   // <group>
00281   virtual Measure *clone() const;
00282   // </group>
00283   
00284  private:
00285   //# Enumerations
00286   
00287   //# Data
00288   
00289   //# Member functions
00290   
00291 };
00292 
00293 
00294 } //# NAMESPACE CASA - END
00295 
00296 #endif