casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PKSMS2reader.h
Go to the documentation of this file.
00001 //#---------------------------------------------------------------------------
00002 //# PKSMS2reader.h: Class to read Parkes Multibeam data from a v2 MS.
00003 //#---------------------------------------------------------------------------
00004 //# livedata - processing pipeline for single-dish, multibeam spectral data.
00005 //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
00006 //#
00007 //# This file is part of livedata.
00008 //#
00009 //# livedata is free software: you can redistribute it and/or modify it under
00010 //# the terms of the GNU General Public License as published by the Free
00011 //# Software Foundation, either version 3 of the License, or (at your option)
00012 //# any later version.
00013 //#
00014 //# livedata is distributed in the hope that it will be useful, but WITHOUT
00015 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00017 //# more details.
00018 //#
00019 //# You should have received a copy of the GNU General Public License along
00020 //# with livedata.  If not, see <http://www.gnu.org/licenses/>.
00021 //#
00022 //# Correspondence concerning livedata may be directed to:
00023 //#        Internet email: mcalabre@atnf.csiro.au
00024 //#        Postal address: Dr. Mark Calabretta
00025 //#                        Australia Telescope National Facility, CSIRO
00026 //#                        PO Box 76
00027 //#                        Epping NSW 1710
00028 //#                        AUSTRALIA
00029 //#
00030 //# http://www.atnf.csiro.au/computing/software/livedata.html
00031 //# $Id: PKSMS2reader.h,v 19.18 2009-09-29 07:33:38 cal103 Exp $
00032 //#---------------------------------------------------------------------------
00033 //# Original: 2000/08/03, Mark Calabretta, ATNF
00034 //#---------------------------------------------------------------------------
00035 
00036 #ifndef ATNF_PKSMS2READER_H
00037 #define ATNF_PKSMS2READER_H
00038 
00039 #include <atnf/PKSIO/PKSreader.h>
00040 #include <atnf/PKSIO/PKSrecord.h>
00041 
00042 #include <casa/aips.h>
00043 #include <casa/Arrays/Matrix.h>
00044 #include <casa/Arrays/Slicer.h>
00045 #include <casa/Arrays/Vector.h>
00046 #include <casa/BasicSL/Complex.h>
00047 #include <casa/BasicSL/String.h>
00048 #include <ms/MeasurementSets/MeasurementSet.h>
00049 #include <tables/Tables/ArrayColumn.h>
00050 #include <tables/Tables/ScalarColumn.h>
00051 
00052 #include <casa/namespace.h>
00053 
00054 // <summary>
00055 // Class to read Parkes Multibeam data from a v2 MS.
00056 // </summary>
00057 
00058 class PKSMS2reader : public PKSreader
00059 {
00060   public:
00061     // Default constructor.
00062     PKSMS2reader();
00063 
00064     // Destructor.
00065     virtual ~PKSMS2reader();
00066 
00067     //  Open the MS for reading.
00068     virtual Int open(
00069         const String msName,
00070         const String antenna,
00071         Vector<Bool> &beams,
00072         Vector<Bool> &IFs,
00073         Vector<uInt> &nChan,
00074         Vector<uInt> &nPol,
00075         Vector<Bool> &haveXPol,
00076         Bool   &haveBase,
00077         Bool   &haveSpectra);
00078 
00079     // Get parameters describing the data.
00080     virtual Int getHeader(
00081         String &observer,
00082         String &project,
00083         String &antName,
00084         Vector<Double> &antPosition,
00085         String &obsMode,
00086         String &bunit,
00087         Float  &equinox,
00088         //String &freqRef,
00089         String &dopplerFrame,
00090         Double &mjd,
00091         Double &refFreq,
00092         Double &bandwidth);
00093 
00094     // Get frequency parameters for each IF.
00095     virtual Int getFreqInfo(
00096         Vector<Double> &startFreq,
00097         Vector<Double> &endFreq);
00098 
00099     // Set data selection criteria.  Channel numbering is 1-relative, zero or
00100     // negative channel numbers are taken to be offsets from the last channel.
00101     virtual uInt select(
00102         const Vector<Bool> beamSel,
00103         const Vector<Bool> IFsel,
00104         const Vector<Int>  startChan,
00105         const Vector<Int>  endChan,
00106         const Vector<Int>  refChan,
00107         const Bool getSpectra = True,
00108         const Bool getXPol    = False,
00109         const Bool getFeedPos = False,
00110         const Bool getPointing = False,
00111         const Int  coordSys   = 0);
00112 
00113 
00114     // Find the range of the data selected in time and position.
00115     virtual Int findRange(
00116         Int    &nRow,
00117         Int    &nSel,
00118         Vector<Double> &timeSpan,
00119         Matrix<Double> &positions);
00120 
00121     // Read the next data record.
00166     virtual Int read(PKSrecord &pksrec);
00167 
00168 
00169     // Read the next data record, just the basics.
00170     virtual Int read(
00171         Int           &IFno,
00172         Vector<Float> &tsys,
00173         Vector<Float> &calFctr,
00174         Matrix<Float> &baseLin,
00175         Matrix<Float> &baseSub,
00176         Matrix<Float> &spectra,
00177         Matrix<uChar> &flagged);
00178 
00179     // Close the MS.
00180     virtual void close(void);
00181 
00182   private:
00183     Vector<String> splitAntennaSelectionString( const String s );
00184     void setupAntennaList( const String s ) ;
00185 
00186     Bool   cHaveBaseLin, cHaveCalFctr, cHaveSrcVel, cHaveTsys, cHaveXCalFctr,
00187            cMSopen, cHaveTcal, cHaveDataCol, cALMA, cHaveSysCal, cHaveCorrectedDataCol;
00188     Int    cCycleNo, cIdx, cNRow, cScanNo;
00189     Double cTime, lastmjd;
00190     Vector<Int>    cEndChan, cRefChan, cStartChan;
00191     Vector<Bool>   cBeams, cIFs;
00192     Vector<Slicer> cDataSel;
00193     String         cDirRef, cTelName;
00194     MeasurementSet cPKSMS;
00195     Table          cSysCalTab, tmptab, tmptab2;
00196 
00197     //Vector<String> cAntenna;
00198     Vector<Int> cAntId;
00199 
00200     ROScalarColumn<Int>     cScanNoCol;
00201     ROScalarColumn<Double>  cTimeCol;
00202     ROScalarColumn<Double>  cIntervalCol;
00203     ROScalarColumn<Int>     cFieldIdCol;
00204     ROScalarColumn<String>  cFieldNameCol;
00205     ROArrayColumn<Double>   cFieldDelayDirCol;
00206     ROScalarColumn<Int>     cSrcIdCol;
00207     ROScalarColumn<Int>     cSrcId2Col;
00208     ROScalarColumn<String>  cSrcNameCol;
00209     ROArrayColumn<Double>   cSrcDirCol;
00210     ROArrayColumn<Double>   cSrcPMCol;
00211     ROArrayColumn<Double>   cSrcVelCol;
00212     ROScalarColumn<Int>     cStateIdCol;
00213     ROScalarColumn<Double>  cCalCol;   
00214     ROScalarColumn<String>  cObsModeCol;
00215     ROArrayColumn<Double>   cSrcRestFrqCol;
00216     ROScalarColumn<Int>     cDataDescIdCol;
00217     ROScalarColumn<Int>     cSpWinIdCol;
00218     ROArrayColumn<Double>   cChanFreqCol;
00219     ROScalarColumn<Double>   cTotBWCol;
00220     ROScalarColumn<Double>  cWeatherTimeCol;
00221     ROScalarColumn<Float>   cTemperatureCol;
00222     ROScalarColumn<Float>   cPressureCol;
00223     ROScalarColumn<Float>   cHumidityCol;
00224     ROArrayColumn<Float>    cTcalCol;
00225     ROScalarColumn<Int>     cBeamNoCol;
00226     ROArrayColumn<Double>   cPointingCol;
00227     ROScalarColumn<Double>  cPointingTimeCol;
00228     ROArrayColumn<Float>    cTsysCol;
00229     ROArrayColumn<Float>    cSigmaCol;
00230     ROArrayColumn<Float>    cCalFctrCol;
00231     ROArrayColumn<Float>    cBaseLinCol;
00232     ROArrayColumn<Float>    cBaseSubCol;
00233     ROArrayColumn<Float>    cFloatDataCol;
00234     ROArrayColumn<Bool>     cFlagCol;
00235     ROScalarColumn<Bool>    cFlagRowCol;
00236     ROScalarColumn<Complex> cXCalFctrCol;
00237     ROArrayColumn<Complex>  cDataCol;
00238     ROArrayColumn<Complex>  cCorrectedDataCol;
00239     ROScalarColumn<Int>     cNumReceptorCol;
00240     ROScalarColumn<Bool>    cSigStateCol;
00241     ROScalarColumn<Bool>    cRefStateCol;
00242     
00243 };
00244 
00245 #endif