| 1 | //#---------------------------------------------------------------------------
 | 
|---|
| 2 | //# PKSMS2reader.h: Class to read Parkes Multibeam data from a v2 MS.
 | 
|---|
| 3 | //#---------------------------------------------------------------------------
 | 
|---|
| 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
 | 
|---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
 | 
|---|
| 6 | //#
 | 
|---|
| 7 | //# This file is part of livedata.
 | 
|---|
| 8 | //#
 | 
|---|
| 9 | //# livedata is free software: you can redistribute it and/or modify it under
 | 
|---|
| 10 | //# the terms of the GNU General Public License as published by the Free
 | 
|---|
| 11 | //# Software Foundation, either version 3 of the License, or (at your option)
 | 
|---|
| 12 | //# any later version.
 | 
|---|
| 13 | //#
 | 
|---|
| 14 | //# livedata is distributed in the hope that it will be useful, but WITHOUT
 | 
|---|
| 15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
|---|
| 16 | //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 | 
|---|
| 17 | //# more details.
 | 
|---|
| 18 | //#
 | 
|---|
| 19 | //# You should have received a copy of the GNU General Public License along
 | 
|---|
| 20 | //# with livedata.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 21 | //#
 | 
|---|
| 22 | //# Correspondence concerning livedata may be directed to:
 | 
|---|
| 23 | //#        Internet email: mcalabre@atnf.csiro.au
 | 
|---|
| 24 | //#        Postal address: Dr. Mark Calabretta
 | 
|---|
| 25 | //#                        Australia Telescope National Facility, CSIRO
 | 
|---|
| 26 | //#                        PO Box 76
 | 
|---|
| 27 | //#                        Epping NSW 1710
 | 
|---|
| 28 | //#                        AUSTRALIA
 | 
|---|
| 29 | //#
 | 
|---|
| 30 | //# http://www.atnf.csiro.au/computing/software/livedata.html
 | 
|---|
| 31 | //# $Id: PKSMS2reader.h,v 19.18 2009-09-29 07:33:38 cal103 Exp $
 | 
|---|
| 32 | //#---------------------------------------------------------------------------
 | 
|---|
| 33 | //# Original: 2000/08/03, Mark Calabretta, ATNF
 | 
|---|
| 34 | //#---------------------------------------------------------------------------
 | 
|---|
| 35 | 
 | 
|---|
| 36 | #ifndef ATNF_PKSMS2READER_H
 | 
|---|
| 37 | #define ATNF_PKSMS2READER_H
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #include <atnf/PKSIO/PKSreader.h>
 | 
|---|
| 40 | #include <atnf/PKSIO/PKSrecord.h>
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #include <casa/aips.h>
 | 
|---|
| 43 | #include <casa/Arrays/Matrix.h>
 | 
|---|
| 44 | #include <casa/Arrays/Slicer.h>
 | 
|---|
| 45 | #include <casa/Arrays/Vector.h>
 | 
|---|
| 46 | #include <casa/BasicSL/Complex.h>
 | 
|---|
| 47 | #include <casa/BasicSL/String.h>
 | 
|---|
| 48 | #include <ms/MeasurementSets/MeasurementSet.h>
 | 
|---|
| 49 | #include <tables/Tables/ArrayColumn.h>
 | 
|---|
| 50 | #include <tables/Tables/ScalarColumn.h>
 | 
|---|
| 51 | 
 | 
|---|
| 52 | #include <casa/namespace.h>
 | 
|---|
| 53 | 
 | 
|---|
| 54 | // <summary>
 | 
|---|
| 55 | // Class to read Parkes Multibeam data from a v2 MS.
 | 
|---|
| 56 | // </summary>
 | 
|---|
| 57 | 
 | 
|---|
| 58 | class PKSMS2reader : public PKSreader
 | 
|---|
| 59 | {
 | 
|---|
| 60 |   public:
 | 
|---|
| 61 |     // Default constructor.
 | 
|---|
| 62 |     PKSMS2reader();
 | 
|---|
| 63 | 
 | 
|---|
| 64 |     // Destructor.
 | 
|---|
| 65 |     virtual ~PKSMS2reader();
 | 
|---|
| 66 | 
 | 
|---|
| 67 |     //  Open the MS for reading.
 | 
|---|
| 68 |     virtual Int open(
 | 
|---|
| 69 |         const String msName,
 | 
|---|
| 70 |         Vector<Bool> &beams,
 | 
|---|
| 71 |         Vector<Bool> &IFs,
 | 
|---|
| 72 |         Vector<uInt> &nChan,
 | 
|---|
| 73 |         Vector<uInt> &nPol,
 | 
|---|
| 74 |         Vector<Bool> &haveXPol,
 | 
|---|
| 75 |         Bool   &haveBase,
 | 
|---|
| 76 |         Bool   &haveSpectra);
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     // Get parameters describing the data.
 | 
|---|
| 79 |     virtual Int getHeader(
 | 
|---|
| 80 |         String &observer,
 | 
|---|
| 81 |         String &project,
 | 
|---|
| 82 |         String &antName,
 | 
|---|
| 83 |         Vector<Double> &antPosition,
 | 
|---|
| 84 |         String &obsMode,
 | 
|---|
| 85 |         String &bunit,
 | 
|---|
| 86 |         Float  &equinox,
 | 
|---|
| 87 |         String &dopplerFrame,
 | 
|---|
| 88 |         Double &mjd,
 | 
|---|
| 89 |         Double &refFreq,
 | 
|---|
| 90 |         Double &bandwidth);
 | 
|---|
| 91 | 
 | 
|---|
| 92 |     // Get frequency parameters for each IF.
 | 
|---|
| 93 |     virtual Int getFreqInfo(
 | 
|---|
| 94 |         Vector<Double> &startFreq,
 | 
|---|
| 95 |         Vector<Double> &endFreq);
 | 
|---|
| 96 | 
 | 
|---|
| 97 |     // Set data selection criteria.  Channel numbering is 1-relative, zero or
 | 
|---|
| 98 |     // negative channel numbers are taken to be offsets from the last channel.
 | 
|---|
| 99 |     virtual uInt select(
 | 
|---|
| 100 |         const Vector<Bool> beamSel,
 | 
|---|
| 101 |         const Vector<Bool> IFsel,
 | 
|---|
| 102 |         const Vector<Int>  startChan,
 | 
|---|
| 103 |         const Vector<Int>  endChan,
 | 
|---|
| 104 |         const Vector<Int>  refChan,
 | 
|---|
| 105 |         const Bool getSpectra = True,
 | 
|---|
| 106 |         const Bool getXPol    = False,
 | 
|---|
| 107 |         const Int  coordSys   = 0);
 | 
|---|
| 108 | 
 | 
|---|
| 109 |     // Find the range of the data selected in time and position.
 | 
|---|
| 110 |     virtual Int findRange(
 | 
|---|
| 111 |         Int    &nRow,
 | 
|---|
| 112 |         Int    &nSel,
 | 
|---|
| 113 |         Vector<Double> &timeSpan,
 | 
|---|
| 114 |         Matrix<Double> &positions);
 | 
|---|
| 115 | 
 | 
|---|
| 116 |     // Read the next data record.
 | 
|---|
| 117 |     virtual Int read(PKSrecord &pksrec);
 | 
|---|
| 118 | 
 | 
|---|
| 119 |     // Close the MS.
 | 
|---|
| 120 |     virtual void close(void);
 | 
|---|
| 121 | 
 | 
|---|
| 122 |   private:
 | 
|---|
| 123 |     Bool   cHaveBaseLin, cHaveCalFctr, cHaveSrcVel, cHaveTsys, cHaveXCalFctr,
 | 
|---|
| 124 |            cMSopen;
 | 
|---|
| 125 |     Int    cCycleNo, cIdx, cNRow, cScanNo;
 | 
|---|
| 126 |     Double cTime;
 | 
|---|
| 127 |     Vector<Int>    cEndChan, cRefChan, cStartChan;
 | 
|---|
| 128 |     Vector<Bool>   cBeams, cIFs;
 | 
|---|
| 129 |     Vector<Slicer> cDataSel;
 | 
|---|
| 130 |     MeasurementSet cPKSMS;
 | 
|---|
| 131 | 
 | 
|---|
| 132 |     ROScalarColumn<Int>     cScanNoCol;
 | 
|---|
| 133 |     ROScalarColumn<Double>  cTimeCol;
 | 
|---|
| 134 |     ROScalarColumn<Double>  cIntervalCol;
 | 
|---|
| 135 |     ROScalarColumn<Int>     cFieldIdCol;
 | 
|---|
| 136 |     ROScalarColumn<String>  cFieldNameCol;
 | 
|---|
| 137 |     ROScalarColumn<Int>     cSrcIdCol;
 | 
|---|
| 138 |     ROScalarColumn<String>  cSrcNameCol;
 | 
|---|
| 139 |     ROArrayColumn<Double>   cSrcDirCol;
 | 
|---|
| 140 |     ROArrayColumn<Double>   cSrcPMCol;
 | 
|---|
| 141 |     ROArrayColumn<Double>   cSrcVelCol;
 | 
|---|
| 142 |     ROScalarColumn<Int>     cStateIdCol;
 | 
|---|
| 143 |     ROScalarColumn<String>  cObsModeCol;
 | 
|---|
| 144 |     ROArrayColumn<Double>   cSrcRestFrqCol;
 | 
|---|
| 145 |     ROScalarColumn<Int>     cDataDescIdCol;
 | 
|---|
| 146 |     ROArrayColumn<Double>   cChanFreqCol;
 | 
|---|
| 147 |     ROScalarColumn<Double>  cWeatherTimeCol;
 | 
|---|
| 148 |     ROScalarColumn<Float>   cTemperatureCol;
 | 
|---|
| 149 |     ROScalarColumn<Float>   cPressureCol;
 | 
|---|
| 150 |     ROScalarColumn<Float>   cHumidityCol;
 | 
|---|
| 151 |     ROScalarColumn<Int>     cBeamNoCol;
 | 
|---|
| 152 |     ROArrayColumn<Double>   cPointingCol;
 | 
|---|
| 153 |     ROArrayColumn<Float>    cTsysCol;
 | 
|---|
| 154 |     ROArrayColumn<Float>    cSigmaCol;
 | 
|---|
| 155 |     ROArrayColumn<Float>    cCalFctrCol;
 | 
|---|
| 156 |     ROArrayColumn<Float>    cBaseLinCol;
 | 
|---|
| 157 |     ROArrayColumn<Float>    cBaseSubCol;
 | 
|---|
| 158 |     ROArrayColumn<Float>    cFloatDataCol;
 | 
|---|
| 159 |     ROArrayColumn<Bool>     cFlagCol;
 | 
|---|
| 160 |     ROScalarColumn<Complex> cXCalFctrCol;
 | 
|---|
| 161 |     ROArrayColumn<Complex>  cDataCol;
 | 
|---|
| 162 |     ROScalarColumn<Int>     cNumReceptorCol;
 | 
|---|
| 163 | };
 | 
|---|
| 164 | 
 | 
|---|
| 165 | #endif
 | 
|---|