casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTPolarization.h
Go to the documentation of this file.
00001 //# GBTPolarization: GBTPolarization holds pol. info for a correlation set.
00002 //# Copyright (C) 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$
00028 
00029 #ifndef NRAO_GBTPOLARIZATION_H
00030 #define NRAO_GBTPOLARIZATION_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Arrays/Matrix.h>
00034 #include <casa/Arrays/Vector.h>
00035 #include <casa/Containers/SimOrdMap.h>
00036 
00037 //# Forward Declarations
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 class String;
00040 } //# NAMESPACE CASA - END
00041 
00042 #include <casa/namespace.h>
00043 
00044 // <summary>
00045 // GBTPolarization holds polarization info for a correlation set.
00046 // </summary>
00047 
00048 // <use visibility=local>
00049 
00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tGBTPolarization" demos="">
00051 // </reviewed>
00052 
00053 // <prerequisite>
00054 //   <li> The POLARIZATION table of the MeasurementSet.
00055 //   <li> The GBT FITS files.
00056 //   <li> The GBT filler.
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // This holds information appropriate for a row of the POLARIZATION table of
00061 // a MS plus information useful in associated a specific correlation
00062 // with a specific sampler in a GBT backend FITS file (and from there,
00063 // to an appropriate row in the IF table and a specific feed).  Hence
00064 // this holds GBT-specific polarization information.
00065 // </etymology>
00066 //
00067 // <motivation>
00068 // When this information was being held by a larger class, it was getting
00069 // confused with other issues related to that class.  By putting it in a
00070 // smaller, simpler class the maintenance will be easier and usage will
00071 // be less confusing.
00072 // </motivation>
00073 
00074 class GBTPolarization
00075 {
00076 public:
00077     // The default correlation.  NUM_CORR=1 and CORR_TYPE[0]=code for "X".
00078     GBTPolarization();
00079 
00080     // A specific correlation from vector of receptor polarization and
00081     // a specific NUM_CORR.  If NUM_CORR == 1 or 2 only the self-products
00082     // are used and polType.nelements() should equal numCorr.  If NUM_CORR==4
00083     // then polType.nelements() should equal 2 and cross-products will
00084     // also be used.  NUM_CORR==3 should never be used.  For efficiency,
00085     // this code only checks those values using DebugAssert and hence
00086     // are only done if AIPS_DEBUG was defined at compile time. 
00087     GBTPolarization(Int numCorr, const Vector<String> polType);
00088 
00089     // copy constructor
00090     GBTPolarization(const GBTPolarization &other);
00091 
00092     ~GBTPolarization() {;}
00093 
00094     // Assignment operator, uses copy syntax.
00095     GBTPolarization &operator=(const GBTPolarization &other);
00096 
00097     // Set up information about a given sampler row.
00098     // Returns False if the implied element in polType doesn't exist.
00099     // samplerInfo always returns True if the default constructor was
00100     // used.  In that case polA and polB always combine to map to
00101     // the single correlation of "XX".
00102     Bool samplerInfo(Int samplerRow,
00103                      const String &polA, const String &polB);
00104 
00105     // the number of correlations
00106     Int numCorr() const {return itsNumCorr;}
00107 
00108     // The polarization of the numCorr correlations
00109     const Vector<Int> &corrType() const {return itsCorrType;}
00110 
00111     // The receptor cross-products.
00112     const Matrix<Int> &corrProduct() const {return itsCorrProduct;}
00113     
00114     // The samplerRows associated with corrType.  An element is -1
00115     // if no information has been provided yet.
00116     const Vector<Int> samplerRows() const {return itsSamplerRows;}
00117 private:
00118     Int itsNumCorr;
00119     Vector<Int> itsCorrType, itsSamplerRows;
00120     Matrix<Int> itsCorrProduct;
00121 
00122     //# facilitates lookup from corr code to element in corrProduct
00123     SimpleOrderedMap<Int, Int> itsCorrMap;
00124 
00125     Bool itsIsDefault;
00126 };
00127                      
00128 #endif