| 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 | const String antenna,
|
|---|
| 71 | Vector<Bool> &beams,
|
|---|
| 72 | Vector<Bool> &IFs,
|
|---|
| 73 | Vector<uInt> &nChan,
|
|---|
| 74 | Vector<uInt> &nPol,
|
|---|
| 75 | Vector<Bool> &haveXPol,
|
|---|
| 76 | Bool &haveBase,
|
|---|
| 77 | Bool &haveSpectra);
|
|---|
| 78 |
|
|---|
| 79 | // Get parameters describing the data.
|
|---|
| 80 | virtual Int getHeader(
|
|---|
| 81 | String &observer,
|
|---|
| 82 | String &project,
|
|---|
| 83 | String &antName,
|
|---|
| 84 | Vector<Double> &antPosition,
|
|---|
| 85 | String &obsMode,
|
|---|
| 86 | String &bunit,
|
|---|
| 87 | Float &equinox,
|
|---|
| 88 | //String &freqRef,
|
|---|
| 89 | String &dopplerFrame,
|
|---|
| 90 | Double &mjd,
|
|---|
| 91 | Double &refFreq,
|
|---|
| 92 | Double &bandwidth);
|
|---|
| 93 |
|
|---|
| 94 | // Get frequency parameters for each IF.
|
|---|
| 95 | virtual Int getFreqInfo(
|
|---|
| 96 | Vector<Double> &startFreq,
|
|---|
| 97 | Vector<Double> &endFreq);
|
|---|
| 98 |
|
|---|
| 99 | // Set data selection criteria. Channel numbering is 1-relative, zero or
|
|---|
| 100 | // negative channel numbers are taken to be offsets from the last channel.
|
|---|
| 101 | virtual uInt select(
|
|---|
| 102 | const Vector<Bool> beamSel,
|
|---|
| 103 | const Vector<Bool> IFsel,
|
|---|
| 104 | const Vector<Int> startChan,
|
|---|
| 105 | const Vector<Int> endChan,
|
|---|
| 106 | const Vector<Int> refChan,
|
|---|
| 107 | const Bool getSpectra = True,
|
|---|
| 108 | const Bool getXPol = False,
|
|---|
| 109 | const Bool getFeedPos = False,
|
|---|
| 110 | const Bool getPointing = False,
|
|---|
| 111 | const Int coordSys = 0);
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 | // Find the range of the data selected in time and position.
|
|---|
| 115 | virtual Int findRange(
|
|---|
| 116 | Int &nRow,
|
|---|
| 117 | Int &nSel,
|
|---|
| 118 | Vector<Double> &timeSpan,
|
|---|
| 119 | Matrix<Double> &positions);
|
|---|
| 120 |
|
|---|
| 121 | // Read the next data record.
|
|---|
| 122 | /**
|
|---|
| 123 | virtual Int read(
|
|---|
| 124 | Int &scanNo,
|
|---|
| 125 | Int &cycleNo,
|
|---|
| 126 | Double &mjd,
|
|---|
| 127 | Double &interval,
|
|---|
| 128 | String &fieldName,
|
|---|
| 129 | String &srcName,
|
|---|
| 130 | Vector<Double> &srcDir,
|
|---|
| 131 | Vector<Double> &srcPM,
|
|---|
| 132 | Double &srcVel,
|
|---|
| 133 | String &obsMode,
|
|---|
| 134 | Int &IFno,
|
|---|
| 135 | Double &refFreq,
|
|---|
| 136 | Double &bandwidth,
|
|---|
| 137 | Double &freqInc,
|
|---|
| 138 | Vector<Double> &restFreq,
|
|---|
| 139 | Vector<Float> &tcal,
|
|---|
| 140 | String &tcalTime,
|
|---|
| 141 | Float &azimuth,
|
|---|
| 142 | Float &elevation,
|
|---|
| 143 | Float &parAngle,
|
|---|
| 144 | Float &focusAxi,
|
|---|
| 145 | Float &focusTan,
|
|---|
| 146 | Float &focusRot,
|
|---|
| 147 | Float &temperature,
|
|---|
| 148 | Float &pressure,
|
|---|
| 149 | Float &humidity,
|
|---|
| 150 | Float &windSpeed,
|
|---|
| 151 | Float &windAz,
|
|---|
| 152 | Int &refBeam,
|
|---|
| 153 | Int &beamNo,
|
|---|
| 154 | Vector<Double> &direction,
|
|---|
| 155 | Vector<Double> &scanRate,
|
|---|
| 156 | Vector<Float> &tsys,
|
|---|
| 157 | Vector<Float> &sigma,
|
|---|
| 158 | Vector<Float> &calFctr,
|
|---|
| 159 | Matrix<Float> &baseLin,
|
|---|
| 160 | Matrix<Float> &baseSub,
|
|---|
| 161 | Matrix<Float> &spectra,
|
|---|
| 162 | Matrix<uChar> &flagged,
|
|---|
| 163 | Complex &xCalFctr,
|
|---|
| 164 | Vector<Complex> &xPol);
|
|---|
| 165 | **/
|
|---|
| 166 | virtual Int read(PKSrecord &pksrec);
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 | // Read the next data record, just the basics.
|
|---|
| 170 | virtual Int read(
|
|---|
| 171 | Int &IFno,
|
|---|
| 172 | Vector<Float> &tsys,
|
|---|
| 173 | Vector<Float> &calFctr,
|
|---|
| 174 | Matrix<Float> &baseLin,
|
|---|
| 175 | Matrix<Float> &baseSub,
|
|---|
| 176 | Matrix<Float> &spectra,
|
|---|
| 177 | Matrix<uChar> &flagged);
|
|---|
| 178 |
|
|---|
| 179 | // Close the MS.
|
|---|
| 180 | virtual void close(void);
|
|---|
| 181 |
|
|---|
| 182 | private:
|
|---|
| 183 | Vector<String> splitAntennaSelectionString( const String s );
|
|---|
| 184 | void setupAntennaList( const String s ) ;
|
|---|
| 185 |
|
|---|
| 186 | Bool cHaveBaseLin, cHaveCalFctr, cHaveSrcVel, cHaveTsys, cHaveXCalFctr,
|
|---|
| 187 | cMSopen, cHaveTcal, cHaveDataCol, cALMA, cHaveSysCal, cHaveCorrectedDataCol;
|
|---|
| 188 | Int cCycleNo, cIdx, cNRow, cScanNo;
|
|---|
| 189 | Double cTime, lastmjd;
|
|---|
| 190 | Vector<Int> cEndChan, cRefChan, cStartChan;
|
|---|
| 191 | Vector<Bool> cBeams, cIFs;
|
|---|
| 192 | Vector<Slicer> cDataSel;
|
|---|
| 193 | String cDirRef, cTelName;
|
|---|
| 194 | MeasurementSet cPKSMS;
|
|---|
| 195 | Table cSysCalTab, tmptab, tmptab2;
|
|---|
| 196 |
|
|---|
| 197 | //Vector<String> cAntenna;
|
|---|
| 198 | Vector<Int> cAntId;
|
|---|
| 199 |
|
|---|
| 200 | ROScalarColumn<Int> cScanNoCol;
|
|---|
| 201 | ROScalarColumn<Double> cTimeCol;
|
|---|
| 202 | ROScalarColumn<Double> cIntervalCol;
|
|---|
| 203 | ROScalarColumn<Int> cFieldIdCol;
|
|---|
| 204 | ROScalarColumn<String> cFieldNameCol;
|
|---|
| 205 | ROArrayColumn<Double> cFieldDelayDirCol;
|
|---|
| 206 | ROScalarColumn<Int> cSrcIdCol;
|
|---|
| 207 | ROScalarColumn<Int> cSrcId2Col;
|
|---|
| 208 | ROScalarColumn<String> cSrcNameCol;
|
|---|
| 209 | ROArrayColumn<Double> cSrcDirCol;
|
|---|
| 210 | ROArrayColumn<Double> cSrcPMCol;
|
|---|
| 211 | ROArrayColumn<Double> cSrcVelCol;
|
|---|
| 212 | ROScalarColumn<Int> cStateIdCol;
|
|---|
| 213 | ROScalarColumn<Double> cCalCol;
|
|---|
| 214 | ROScalarColumn<String> cObsModeCol;
|
|---|
| 215 | ROArrayColumn<Double> cSrcRestFrqCol;
|
|---|
| 216 | ROScalarColumn<Int> cDataDescIdCol;
|
|---|
| 217 | ROScalarColumn<Int> cSpWinIdCol;
|
|---|
| 218 | ROArrayColumn<Double> cChanFreqCol;
|
|---|
| 219 | ROScalarColumn<Double> cTotBWCol;
|
|---|
| 220 | ROScalarColumn<Double> cWeatherTimeCol;
|
|---|
| 221 | ROScalarColumn<Float> cTemperatureCol;
|
|---|
| 222 | ROScalarColumn<Float> cPressureCol;
|
|---|
| 223 | ROScalarColumn<Float> cHumidityCol;
|
|---|
| 224 | ROArrayColumn<Float> cTcalCol;
|
|---|
| 225 | ROScalarColumn<Int> cBeamNoCol;
|
|---|
| 226 | ROArrayColumn<Double> cPointingCol;
|
|---|
| 227 | ROScalarColumn<Double> cPointingTimeCol;
|
|---|
| 228 | ROArrayColumn<Float> cTsysCol;
|
|---|
| 229 | ROArrayColumn<Float> cSigmaCol;
|
|---|
| 230 | ROArrayColumn<Float> cCalFctrCol;
|
|---|
| 231 | ROArrayColumn<Float> cBaseLinCol;
|
|---|
| 232 | ROArrayColumn<Float> cBaseSubCol;
|
|---|
| 233 | ROArrayColumn<Float> cFloatDataCol;
|
|---|
| 234 | ROArrayColumn<Bool> cFlagCol;
|
|---|
| 235 | ROScalarColumn<Bool> cFlagRowCol;
|
|---|
| 236 | ROScalarColumn<Complex> cXCalFctrCol;
|
|---|
| 237 | ROArrayColumn<Complex> cDataCol;
|
|---|
| 238 | ROArrayColumn<Complex> cCorrectedDataCol;
|
|---|
| 239 | ROScalarColumn<Int> cNumReceptorCol;
|
|---|
| 240 | ROScalarColumn<Bool> cSigStateCol;
|
|---|
| 241 | ROScalarColumn<Bool> cRefStateCol;
|
|---|
| 242 |
|
|---|
| 243 | };
|
|---|
| 244 |
|
|---|
| 245 | #endif
|
|---|