casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
VLAADA.h
Go to the documentation of this file.
00001 //# VLAADA: 
00002 //# Copyright (C) 1999,2000,2001
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$
00028 
00029 #ifndef NRAO_VLAADA_H
00030 #define NRAO_VLAADA_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/IO/ByteSource.h>
00034 #include <measures/Measures/Stokes.h>
00035 #include <nrao/VLA/VLAEnum.h>
00036 
00037 #include <casa/namespace.h>
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 class String;
00040 template <class T> class Vector;
00041 } //# NAMESPACE CASA - END
00042 
00043 
00044 // <summary>
00045 // Interprets the data in an antenna data area of a VLA logical record.
00046 // </summary>
00047 
00048 // <use visibility=export>
00049 
00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00051 // </reviewed>
00052 
00053 // <prerequisite>
00054 //   <li> The VLA archive format as described in VLA computer memo 188
00055 // </prerequisite>
00056 //
00057 // <etymology> The antenna data is, in memo 188, frequently shortened to the
00058 // acronym ADA. As this is specific to the VLA the name VLAADA seemed
00059 // appropriate.
00060 // </etymology>
00061 //
00062 // <synopsis> 
00063 // This class contains functions which access and interpret the data in an
00064 // antenna data area of a VLA logical record. Only data within one antenna data
00065 // are is accessable with this class, and multiple instances of this class are
00066 // needed to simultaneously look at the data in the other antenna data areas
00067 // in a VLA logical record. 
00068 //
00069 // The functions in this class access the specified data in the antenna data
00070 // area, and may convert the units and data types so something more suitable
00071 // for general use. They also interpret the data and provide some derived
00072 // quantities eg., the padName function.
00073 // </synopsis>
00074 //
00075 // <example>
00076 // This code fragment shows how to initialise a Block of objects of this class
00077 // and then use these objects to determine which antenna is on which pad. It
00078 // is assumed that the Bytesource object contains a VLA Logical record.
00079 // <srcblock>
00080 //   ByteSource VLARecord(...);
00081 //   Block<VLAADA> adaBlock;
00082 //   VLARCA rca(VLARecord);
00083 //   const uInt nant = rca.nAntennas();
00084 //   adaBlock.resize(nant);
00085 //   for (uInt a = 0; a < nant; a++) {
00086 //     adaBlock[a].attach(VLARecord, rca.ADAOffset(a));
00087 //     cout << "Antenna " << adaBlock[a].antName() 
00088 //       << " is on pad " << adaBlock[a].padName() << endl;
00089 //   }
00090 // </srcblock>
00091 // </example>
00092 //
00093 // <motivation>
00094 // This class was needed as part of the VLA filler application. 
00095 // </motivation>
00096 //
00097 // <thrown>
00098 // When compiled in debug mode this class does a lot of consistancy
00099 // checking. If it detects anomolies it will throw an exception (AipsError).
00100 // </thrown>
00101 //
00102 // <todo asof="1999/08/11">
00103 //   <li> The member functions should probably be rounded out.
00104 // </todo>
00105 
00106 class VLAADA
00107 {
00108 public:
00109   // The default constructor creates a unusable object. You need to use the
00110   // assignment operator or the attach function to create a usable object.
00111   VLAADA();
00112 
00113   // Construct this object to read data from the specified VLA logical
00114   // record. The antenna data area that will be used begins at the specified
00115   // number of bytes from the beginning of the record.
00116   VLAADA(ByteSource& record, uInt offset);
00117 
00118   // The destructor is trivial.
00119   ~VLAADA();
00120 
00121   // The copy constructor uses reference semantics.
00122   VLAADA(const VLAADA& other);
00123 
00124   // The assignment constructor uses reference semantics.
00125   VLAADA& operator=(const VLAADA& other);
00126     
00127   // Re-initialise this object so that it now reads data from the given VLA
00128   // logical record.  The antenna data area that will be used begins at the
00129   // specified number of bytes from the beginning of the record.
00130   void attach(ByteSource& record, uInt offset);
00131   
00132   // return the antenna name. This is a string version of the antenna id n is a
00133   // one or two digit number that contains the antenna identifier (see below).
00134   String antName(Bool newStyle=True) const;
00135 
00136   // returns the antenna Id. This is a number which stays with the "steel" and
00137   // gets moved to new locations. It is not the pad number. It is between 1
00138   // and 28 inclusive.
00139   uInt antId() const;
00140 
00141   // Front end Temp...gives a clue if antenna is EVLA
00142   Float frontEndTemp(VLAEnum::IF which) const;
00143   // return the pad name that this antenna is currently located on. This is
00144   // obtained by knowing where the pads are and looking at the bx position of
00145   // the antenna (the bx position in the logical record has to be within half a
00146   // meter of the value given in an table). Pad names are of the form "Nn" or
00147   // "En" or "Wn" where n is a one or two digit number that has an approximate
00148   // correspondence with the distance of the pad from the centre of the array.
00149   String padName() const;
00150 
00151   // return the u coordinate in meters of this antenna at the centre of the
00152   // integration. 
00153   Double u() const;
00154 
00155   // return the v coordinate in meters of this antenna at the centre of the
00156   // integration. 
00157   Double v() const;
00158 
00159   // return the w coordinate in meters of this antenna at the centre of the
00160   // integration. 
00161   Double w() const;
00162 
00163   // return the Bx position in meters of this antenna, from the centre of the
00164   // Array.
00165   Double bx() const;
00166 
00167   // return the By position in meters of this antenna, from the centre of the
00168   // Array.
00169   Double by() const;
00170 
00171   // return the Bz position in meters of this antenna, from the centre of the
00172   // Array.
00173   Double bz() const;
00174 
00175   // return the bx, by, bz positions in meters of this antenna, from the centre
00176   // of the Array.
00177   Vector<Double> pos() const;
00178 
00179   // return the IF status. The status indicates how bad the data probably is
00180   // for the specified if and the current antenna. Values of zero indicate the
00181   // IF is OK, 1 is a warning, 2 means not so good, and bigger numbers, up to
00182   // 15 mean the IF is successively worse.
00183   uInt ifStatus(VLAEnum::IF which) const;
00184 
00185   // returns the nominal sensitivity of the specified IF. These numbers are
00186   // multiplied by the raw correlaton co-efficients to produce the numbers in
00187   // the correlation data area.
00188   Float nominalSensitivity(VLAEnum::IF which) const;
00189 
00190   // return the IF polarisation. Normally at the VLA IF's A & B measure
00191   // right-hand-circular polarisation, and IF's C & D measure
00192   // left-hand-circular polarisation. But in special circumstances this can be
00193   // swapped. This function returns Stokes::RCircular or Stokes::LCircular.
00194   Stokes::StokesTypes ifPol(VLAEnum::IF which) const;
00195 
00196   // Has the nominal sensitivity amplitude scaling been applied?
00197   //  (auto-True prior to revision 25 [exclusive])
00198   Bool nomSensApplied(VLAEnum::IF which, const uInt rev) const;
00199 
00200   // Identifies which array an antennn belongs to: VLA, EVLA, or VLBA
00201   String arrayName() const;
00202 
00203   // Function which checks the internal data of this class for consistant
00204   // values. Returns True if everything is fine otherwise returns False.
00205   Bool ok() const;
00206 
00207 private:
00208   //# Contains a VLA logical record
00209   mutable ByteSource itsRecord;
00210   //# the offset to the start of this ADA in the record. An offset of zero
00211   //# means this ADA is not used in this record.
00212   uInt itsOffset;
00213 };
00214 #endif