casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CTMainColumns.h
Go to the documentation of this file.
00001 //# CTMainColumns.h: Calibration table cal_main column access
00002 //# Copyright (C) 2011 
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 adressed 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: CTMainColumns.h 23338 2013-03-21 04:03:20Z george.moellenbrock $
00028 
00029 #ifndef CALIBRATION_NEWCALMAINCOLUMNS_H
00030 #define CALIBRATION_NEWCALMAINCOLUMNS_H
00031 
00032 #include <casa/aips.h>
00033 #include <measures/Measures/MEpoch.h>
00034 #include <measures/Measures/MFrequency.h>
00035 #include <measures/Measures/MDirection.h>
00036 #include <tables/Tables/TableColumn.h>
00037 #include <tables/Tables/ScalarColumn.h>
00038 #include <tables/Tables/ArrayColumn.h>
00039 #include <measures/TableMeasures/TableMeasColumn.h>
00040 #include <measures/TableMeasures/ScalarMeasColumn.h>
00041 #include <measures/TableMeasures/ArrayMeasColumn.h>
00042 #include <measures/TableMeasures/ScalarQuantColumn.h>
00043 #include <synthesis/CalTables/NewCalTable.h>
00044 #include <synthesis/CalTables/CTEnums.h>
00045 
00046 namespace casa { //# NAMESPACE CASA - BEGIN
00047 
00048 class NewCalTable;
00049 
00050 class ROCTMainColumns
00051 {
00052  public:
00053   // Construct from a calibration table
00054   ROCTMainColumns (const NewCalTable& calTable);
00055   
00056   // Default destructor
00057   virtual ~ROCTMainColumns() {};
00058   
00059   // Read-only column accessors
00060   const ROScalarColumn<Double>& time() const {return time_p;};
00061   const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;};
00062   const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;};
00063   const ROScalarColumn<Double>& timeEP() const {return timeEP_p;};
00064   const ROScalarQuantColumn<Double>& timeEPQuant() const 
00065   {return timeEPQuant_p;};
00066   const ROScalarColumn<Double>& interval() const {return interval_p;};
00067   const ROScalarQuantColumn<Double>& intervalQuant() const
00068   {return intervalQuant_p;};
00069   const ROScalarColumn<Int>& antenna1() const {return antenna1_p;};
00070   const ROScalarColumn<Int>& antenna2() const {return antenna2_p;};
00071   const ROScalarColumn<Int>& fieldId() const {return fieldId_p;};
00072   const ROScalarColumn<Int>& spwId() const {return spwId_p;};
00073   const ROScalarColumn<Int>& scanNo() const {return scanNo_p;};
00074   const ROScalarColumn<Int>& obsId() const {return obsId_p;};
00075   const ROArrayColumn<Complex>& cparam() const {return cparam_p;};
00076   const ROArrayColumn<Float>& fparam() const {return fparam_p;};
00077   const ROArrayColumn<Float>& paramerr() const {return paramerr_p;};
00078   const ROArrayColumn<Bool>& flag() const {return flag_p;};
00079   const ROArrayColumn<Float>& snr() const {return snr_p;};
00080   const ROArrayColumn<Float>& weight() const {return weight_p;};
00081 
00082   // Some additional methods to extract cparam into Array<Float>
00083   //   what can be: "","AP"
00084   Array<Float> fparamArray(String what="",const Vector<uInt>& rows=Vector<uInt>());
00085   void fparamArray(Array<Float>& arr,String what="",const Vector<uInt>& rows=Vector<uInt>());
00086 
00087   // Some additional methods to extract phase-like info
00088   Array<Float> phase();
00089   void phase(Array<Float>& ph);
00090   Array<Float> cycles();
00091   void cycles(Array<Float>& cy);
00092   
00093  protected:
00094   // Prohibit public use of the null constructor, which
00095   // does not produce a usable object.
00096   ROCTMainColumns() {};
00097   
00098   // Return a CalTable as a Table reference. Utilizes friendship
00099   // relationship with class CalTable.
00100   //const Table& asTable(const CalTable2& calTable) 
00101   //{return calTable.calMainAsTable();}
00102   
00103   // Attach a table column accessor
00104   void attach (const NewCalTable& calTable, ROTableColumn& tabCol, 
00105                CTEnums::colDef colEnum, const Bool& optional = False);
00106   void attach (const NewCalTable& calTable, 
00107                ROArrayMeasColumn<MEpoch>& tabCol, 
00108                CTEnums::colDef colEnum, const Bool& optional = False);
00109   void attach (const NewCalTable& calTable, 
00110                ROArrayMeasColumn<MFrequency>& tabCol, 
00111                CTEnums::colDef colEnum, const Bool& optional = False);
00112   void attach (const NewCalTable& calTable, 
00113                ROArrayMeasColumn<MDirection>& tabCol, 
00114                CTEnums::colDef colEnum, const Bool& optional = False);
00115   void attach (const NewCalTable& calTable, ROScalarMeasColumn<MEpoch>& tabCol, 
00116                CTEnums::colDef colEnum, const Bool& optional = False);
00117   void attach (const NewCalTable& calTable, ROScalarQuantColumn<Double>& tabCol, 
00118                CTEnums::colDef colEnum, const Bool& optional = False);
00119   
00120  private:
00121   // Prohibit copy constructor and assignment operator 
00122   ROCTMainColumns (const ROCTMainColumns&);
00123   ROCTMainColumns& operator= (const ROCTMainColumns&);
00124   
00125   // Private column accessors
00126   ROScalarColumn<Double> time_p;
00127   ROScalarQuantColumn<Double> timeQuant_p;
00128   ROScalarMeasColumn<MEpoch> timeMeas_p;
00129   ROScalarColumn<Double> timeEP_p;
00130   ROScalarQuantColumn<Double> timeEPQuant_p;
00131   ROScalarColumn<Double> interval_p;
00132   ROScalarQuantColumn<Double> intervalQuant_p;
00133   ROScalarColumn<Int> antenna1_p;
00134   ROScalarColumn<Int> antenna2_p;
00135   ROScalarColumn<Int> fieldId_p;
00136   ROScalarColumn<Int> spwId_p;
00137   ROScalarColumn<Int> scanNo_p;
00138   ROScalarColumn<Int> obsId_p;
00139   ROArrayColumn<Complex> cparam_p;
00140   ROArrayColumn<Float> fparam_p;
00141   ROArrayColumn<Float> paramerr_p;
00142   ROArrayColumn<Bool> flag_p;
00143   ROArrayColumn<Float> snr_p;
00144   ROArrayColumn<Float> weight_p;
00145 };
00146 
00147 class CTMainColumns
00148 {
00149   public:
00150     // Construct from a calibration table
00151     CTMainColumns (NewCalTable& calTable);
00152     
00153     // Default destructor
00154     virtual ~CTMainColumns() {};
00155     
00156     // Read-write column accessors
00157     ScalarColumn<Double>& time() {return time_p;};
00158     ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;};
00159     ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;};
00160     ScalarColumn<Double>& timeEP() {return timeEP_p;};
00161     ScalarQuantColumn<Double>& timeEPQuant() {return timeEPQuant_p;};
00162     ScalarColumn<Double>& interval() {return interval_p;};
00163     ScalarQuantColumn<Double>& intervalQuant() {return intervalQuant_p;};
00164     ScalarColumn<Int>& fieldId() {return fieldId_p;};
00165     ScalarColumn<Int>& spwId() {return spwId_p;};
00166     ScalarColumn<Int>& antenna1() {return antenna1_p;};
00167     ScalarColumn<Int>& antenna2() {return antenna2_p;};
00168     ScalarColumn<Int>& scanNo() {return scanNo_p;};
00169     ScalarColumn<Int>& obsId() {return obsId_p;};
00170     ArrayColumn<Complex>& cparam() {return cparam_p;};
00171     ArrayColumn<Float>& fparam() {return fparam_p;};
00172     ArrayColumn<Float>& paramerr() {return paramerr_p;};
00173     ArrayColumn<Bool>& flag() {return flag_p;};
00174     ArrayColumn<Float>& snr() {return snr_p;};
00175     ArrayColumn<Float>& weight() {return weight_p;};
00176     
00177   protected:
00178     // Prohibit public use of the null constructor, which
00179     // does not produce a usable object.
00180     CTMainColumns() {};
00181     
00182     // Return a CalTable as a Table reference. Utilizes friendship
00183     // relationship with class CalTable.
00184     //Table& asTable(CalTable2& calTable) {return calTable.calMainAsTable();}
00185     
00186     // Attach a table column accessor
00187     void attach (NewCalTable& calTable, TableColumn& tabCol, 
00188                  CTEnums::colDef colEnum, const Bool& optional = False);
00189     void attach (NewCalTable& calTable, ArrayMeasColumn<MEpoch>& tabCol, 
00190                  CTEnums::colDef colEnum, const Bool& optional = False);
00191     void attach (NewCalTable& calTable, ArrayMeasColumn<MFrequency>& tabCol, 
00192                  CTEnums::colDef colEnum, const Bool& optional = False);
00193     void attach (NewCalTable& calTable, ArrayMeasColumn<MDirection>& tabCol, 
00194                  CTEnums::colDef colEnum, const Bool& optional = False);
00195     void attach (NewCalTable& calTable, ScalarMeasColumn<MEpoch>& tabCol, 
00196                  CTEnums::colDef colEnum, const Bool& optional = False);
00197     void attach (NewCalTable& calTable, ScalarQuantColumn<Double>& tabCol, 
00198                  CTEnums::colDef colEnum, const Bool& optional = False);
00199     
00200   private:
00201     // Prohibit copy constructor and assignment operator 
00202     CTMainColumns (const CTMainColumns&);
00203     CTMainColumns& operator= (const CTMainColumns&);
00204     
00205     // Private column accessors
00206     ScalarColumn<Double> time_p;
00207     ScalarQuantColumn<Double> timeQuant_p;
00208     ScalarMeasColumn<MEpoch> timeMeas_p;
00209     ScalarColumn<Double> timeEP_p;
00210     ScalarQuantColumn<Double> timeEPQuant_p;
00211     ScalarColumn<Double> interval_p;
00212     ScalarQuantColumn<Double> intervalQuant_p;
00213     ScalarColumn<Int> fieldId_p;
00214     ScalarColumn<Int> spwId_p;
00215     ScalarColumn<Int> antenna1_p;
00216     ScalarColumn<Int> antenna2_p;
00217     ScalarColumn<Int> scanNo_p;
00218     ScalarColumn<Int> obsId_p;
00219     ArrayColumn<Complex> cparam_p;
00220     ArrayColumn<Float> fparam_p;
00221     ArrayColumn<Float> paramerr_p;
00222     ArrayColumn<Bool> flag_p;
00223     ArrayColumn<Float> snr_p;
00224     ArrayColumn<Float> weight_p;
00225   };
00226 } //# NAMESPACE CASA - END
00227 #endif