Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/MSCalEngine_8h_source.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 21:00:14 2011
Кодировка:
casacore: derivedmscal/DerivedMC/MSCalEngine.h Source File

MSCalEngine.h

Go to the documentation of this file.
00001 //# MSCalEngine.h: Engine to calculate derived MS values
00002 //# Copyright (C) 2010
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 //# $Id: MSCalEngine.h 20941 2010-08-25 18:35:26Z gervandiepen $
00027 
00028 #ifndef DERIVEDMSCAL_MSCALENGINE_H
00029 #define DERIVEDMSCAL_MSCALENGINE_H
00030 
00031 //# Includes
00032 #include <tables/Tables/Table.h>
00033 #include <tables/Tables/ScalarColumn.h>
00034 #include <measures/Measures/MDirection.h>
00035 #include <measures/Measures/MPosition.h>
00036 #include <measures/Measures/MEpoch.h>
00037 #include <measures/Measures/MBaseline.h>
00038 #include <measures/Measures/MeasConvert.h>
00039 #include <measures/TableMeasures/ScalarMeasColumn.h>
00040 #include <casa/vector.h>
00041 #include <casa/stdmap.h>
00042 
00043 namespace casa {
00044 
00045 // <summary>
00046 // Engine to calculate derived MS values
00047 // </summary>
00048 
00049 // <use visibility=export>
00050 
00051 // <reviewed reviewer="" date="" tests="tDerivedMSCal.cc">
00052 // </reviewed>
00053 
00054 // <prerequisite>
00055 //# Classes you should understand before using this one.
00056 //   <li> MeasurementSet
00057 // </prerequisite>
00058 
00059 // <synopsis>
00060 // MSCalEngine is a class used to calculate derived MeasurementSet
00061 // values hourangle, parallactic angle, azimuth/elevation,
00062 // and local sidereal time.
00063 // It is used by the DerivedMSCal virtual columns and UDFs, but can
00064 // be used by other software as well.
00065 //
00066 // The following values can be obtained:
00067 // <ul>
00068 //  <li> HA is the hourangle of the array center (observatory position).
00069 //  <li> HA1 is the hourangle of ANTENNA1.
00070 //  <li> HA2 is the hourangle of ANTENNA2.
00071 //  <li> LAST is the local sidereal time of the array center.
00072 //  <li> LAST1 is the local sidereal time of ANTENNA1.
00073 //  <li> LAST2 is the local sidereal time of ANTENNA2.
00074 //  <li> PA1 is the parallactic angle of ANTENNA1.
00075 //  <li> PA2 is the parallactic angle of ANTENNA2.
00076 //  <li> AZEL1 is the azimuth/elevation of ANTENNA1.
00077 //  <li> AZEL2 is the azimuth/elevation of ANTENNA2.
00078 //  <li> UVW_J2000 is the UVW coordinates in J2000 (in meters)
00079 // </ul>
00080 // All values have data type double and unit radian (except UVW). The AZEL
00081 // and UVW cvalues are arrays while the others are scalars.
00082 //
00083 // This engine is meant for a MeasurementSet, but can be used for any table
00084 // containing an ANTENNA and FIELD subtable and the relevant columns in the
00085 // main table (ANTENNA1 and/or ANTENNA2, FIELD_ID, and TIME).
00086 // <br>In principle the array center is the Observatory position, which is
00087 // taken from the Measures Observatory table using the telescope name found
00088 // in the OBSERVATION subtable. However, if the subtable is not defined or
00089 // empty or if the telescope name is unknown, the position of the first antenna
00090 // is used as the array position.
00091 //
00092 // The engine can also be used for a CASA Calibration Table. It understands
00093 // how it references the MeasurementSets. Because calibration tables contain
00094 // no ANTENNA2 columns, columns XX2 are the same as XX1.
00095 // </synopsis>
00096 
00097 // <motivation>
00098 // Factor out common code.
00099 // </motivation>
00100 
00101 // <todo asof="$DATE:$">
00102 //  <li> Take care of the feeds and their offsets.
00103 //  <li> Have a conversion engine per field/antenna/feed?
00104 // </todo>
00105 
00106 class MSCalEngine
00107 {
00108 public:
00109   // Default constructor.
00110   MSCalEngine();
00111 
00112   // Destructor.
00113   ~MSCalEngine();
00114 
00115   // Use the given table (MS or CalTable) in the engine.
00116   void setTable (const Table&);
00117 
00118   // Get the hourangle for the given row.
00119   double getHA (Int antnr, uInt rownr);
00120 
00121   // Get the parallatic angle for the given row.
00122   double getPA (Int antnr, uInt rownr);
00123 
00124   // Get the local sidereal time for the given row.
00125   double getLAST (Int antnr, uInt rownr);
00126 
00127   // Get the azimuth/elevation for the given row.
00128   void getAzEl (Int antnr, uInt rownr, Array<Double>&);
00129 
00130   // Get the UVW in J2000 for the given row.
00131   void getUVWJ2000 (uInt rownr, Array<Double>&);
00132 
00133 private:
00134   // Copy constructor cannot be used.
00135   MSCalEngine (const MSCalEngine& that);
00136 
00137   // Assignment cannot be used.
00138   MSCalEngine& operator= (const MSCalEngine& that);
00139   
00140   // Set the data in the measure converter machines.
00141   // It returns the mount of the antenna.
00142   Int setData (Int antnr, uInt rownr);
00143 
00144   // Initialize the column objects, etc.
00145   void init();
00146 
00147   // Fill the CalDesc info for calibration tables.
00148   void fillCalDesc();
00149 
00150   // Fill or update the antenna positions from the ANTENNA subtable at
00151   // row calDescId. It is stored in the calInx-th entry of itsAntPos/itsMount.
00152   void fillAntPos (Int calDescId, Int calInx);
00153 
00154   // Fill or update the field directions from the FIELD subtable at
00155   // row calDescId. It is stored in the calInx-th entry of itsFieldDir.
00156   void fillFieldDir (Int calDescId, Int calInx);
00157 
00158   // Get a calibration MS subtable for the given id.
00159   Table getSubTable (Int calDescId, const String& subTabName,
00160                      Bool mustExist=True);
00161 
00162   //# Declare member variables.
00163   Table                       itsTable;        //# MS or CalTable to use
00164   Int                         itsLastCalInx;   //# id of CAL_DESC last used
00165   Int                         itsLastFieldId;  //# id of the field last used
00166   Int                         itsLastAntId;    //# -1 is array position used
00167   Double                      itsLastTime;
00168   ROScalarColumn<Int>         itsAntCol[2];    //# ANTENNA1 and ANTENNA2
00169   ROScalarColumn<Int>         itsFeedCol[2];   //# FEED1 and FEED2
00170   ROScalarColumn<Int>         itsFieldCol;     //# FIELD_ID
00171   ROScalarColumn<Double>      itsTimeCol;      //# TIME
00172   ROScalarMeasColumn<MEpoch>  itsTimeMeasCol;  //# TIME as Measure
00173   ROScalarColumn<Int>         itsCalCol;       //# CAL_DESC_ID
00174   map<string,int>             itsCalMap;       //# map of MS name to index
00175   vector<Int>                 itsCalIdMap;     //# map of calId to index
00176   MPosition                   itsArrayPos;
00177   vector<vector<MPosition> >  itsAntPos;       //# ITRF antenna positions
00178   vector<vector<Int> >        itsMount;        //# 1=alt-az  0=else
00179   vector<vector<MDirection> > itsFieldDir;     //# J2000 field directions
00180   vector<vector<MBaseline> >  itsAntMB;        //# J2000 MBaseline per antenna
00181   vector<vector<Vector<double> > > itsAntUvw;  //# J2000 UVW per antenna
00182   vector<Block<bool> >        itsUvwFilled;    //# is UVW filled for antenna i?
00183   MDirection::Convert         itsRADecToAzEl;  //# converter ra/dec to az/el
00184   MDirection::Convert         itsPoleToAzEl;   //# converter pole to az/el
00185   MDirection::Convert         itsRADecToHADec; //# converter ra/dec to ha/dec
00186   MEpoch::Convert             itsUTCToLAST;    //# converter UTC to LAST
00187   MBaseline::Convert          itsBLToJ2000;    //# convert ITRF to J2000
00188   MeasFrame                   itsFrame;        //# frame used by the converters
00189 };
00190 
00191 
00192 } //# end namespace
00193 
00194 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines