[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# PKSMS2reader.h: Class to read Parkes Multibeam data from a v2 MS. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
[1720] | 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data. |
---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO |
---|
[1325] | 6 | //# |
---|
[1720] | 7 | //# This file is part of livedata. |
---|
[1325] | 8 | //# |
---|
[1720] | 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 |
---|
[1325] | 15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
[1720] | 16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
| 17 | //# more details. |
---|
[1325] | 18 | //# |
---|
[1720] | 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/>. |
---|
[1325] | 21 | //# |
---|
[1720] | 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 |
---|
[1325] | 29 | //# |
---|
[1720] | 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 $ |
---|
[1325] | 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> |
---|
[1452] | 40 | #include <atnf/PKSIO/PKSrecord.h> |
---|
[1325] | 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 | |
---|
[1452] | 52 | #include <casa/namespace.h> |
---|
| 53 | |
---|
[1325] | 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, |
---|
[1779] | 70 | const String antenna, |
---|
[1325] | 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, |
---|
[1399] | 86 | String &bunit, |
---|
[1325] | 87 | Float &equinox, |
---|
[1779] | 88 | //String &freqRef, |
---|
[1399] | 89 | String &dopplerFrame, |
---|
[1325] | 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, |
---|
[1779] | 109 | const Bool getFeedPos = False, |
---|
| 110 | const Bool getPointing = False, |
---|
[1452] | 111 | const Int coordSys = 0); |
---|
[1325] | 112 | |
---|
[1779] | 113 | |
---|
[1325] | 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. |
---|
[1779] | 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 | **/ |
---|
[1452] | 166 | virtual Int read(PKSrecord &pksrec); |
---|
[1325] | 167 | |
---|
[1779] | 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 | |
---|
[1325] | 179 | // Close the MS. |
---|
| 180 | virtual void close(void); |
---|
| 181 | |
---|
| 182 | private: |
---|
[1779] | 183 | Vector<String> splitAntennaSelectionString( const String s ); |
---|
| 184 | void setupAntennaList( const String s ) ; |
---|
| 185 | |
---|
[1325] | 186 | Bool cHaveBaseLin, cHaveCalFctr, cHaveSrcVel, cHaveTsys, cHaveXCalFctr, |
---|
[1779] | 187 | cMSopen, cHaveTcal, cHaveDataCol, cALMA, cHaveSysCal, cHaveCorrectedDataCol; |
---|
[1325] | 188 | Int cCycleNo, cIdx, cNRow, cScanNo; |
---|
[1779] | 189 | Double cTime, lastmjd; |
---|
[1325] | 190 | Vector<Int> cEndChan, cRefChan, cStartChan; |
---|
| 191 | Vector<Bool> cBeams, cIFs; |
---|
| 192 | Vector<Slicer> cDataSel; |
---|
[1779] | 193 | String cDirRef, cTelName; |
---|
[1325] | 194 | MeasurementSet cPKSMS; |
---|
[1779] | 195 | Table cSysCalTab, tmptab, tmptab2; |
---|
[1325] | 196 | |
---|
[1779] | 197 | //Vector<String> cAntenna; |
---|
| 198 | Vector<Int> cAntId; |
---|
| 199 | |
---|
[1325] | 200 | ROScalarColumn<Int> cScanNoCol; |
---|
| 201 | ROScalarColumn<Double> cTimeCol; |
---|
| 202 | ROScalarColumn<Double> cIntervalCol; |
---|
| 203 | ROScalarColumn<Int> cFieldIdCol; |
---|
| 204 | ROScalarColumn<String> cFieldNameCol; |
---|
[1779] | 205 | ROArrayColumn<Double> cFieldDelayDirCol; |
---|
[1325] | 206 | ROScalarColumn<Int> cSrcIdCol; |
---|
[1779] | 207 | ROScalarColumn<Int> cSrcId2Col; |
---|
[1325] | 208 | ROScalarColumn<String> cSrcNameCol; |
---|
| 209 | ROArrayColumn<Double> cSrcDirCol; |
---|
| 210 | ROArrayColumn<Double> cSrcPMCol; |
---|
| 211 | ROArrayColumn<Double> cSrcVelCol; |
---|
| 212 | ROScalarColumn<Int> cStateIdCol; |
---|
[1779] | 213 | ROScalarColumn<Double> cCalCol; |
---|
[1325] | 214 | ROScalarColumn<String> cObsModeCol; |
---|
| 215 | ROArrayColumn<Double> cSrcRestFrqCol; |
---|
| 216 | ROScalarColumn<Int> cDataDescIdCol; |
---|
[1779] | 217 | ROScalarColumn<Int> cSpWinIdCol; |
---|
[1325] | 218 | ROArrayColumn<Double> cChanFreqCol; |
---|
[1779] | 219 | ROScalarColumn<Double> cTotBWCol; |
---|
[1325] | 220 | ROScalarColumn<Double> cWeatherTimeCol; |
---|
| 221 | ROScalarColumn<Float> cTemperatureCol; |
---|
| 222 | ROScalarColumn<Float> cPressureCol; |
---|
| 223 | ROScalarColumn<Float> cHumidityCol; |
---|
[1779] | 224 | ROArrayColumn<Float> cTcalCol; |
---|
[1325] | 225 | ROScalarColumn<Int> cBeamNoCol; |
---|
| 226 | ROArrayColumn<Double> cPointingCol; |
---|
[1779] | 227 | ROScalarColumn<Double> cPointingTimeCol; |
---|
[1325] | 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; |
---|
[1779] | 235 | ROScalarColumn<Bool> cFlagRowCol; |
---|
[1325] | 236 | ROScalarColumn<Complex> cXCalFctrCol; |
---|
| 237 | ROArrayColumn<Complex> cDataCol; |
---|
[1779] | 238 | ROArrayColumn<Complex> cCorrectedDataCol; |
---|
[1325] | 239 | ROScalarColumn<Int> cNumReceptorCol; |
---|
[1779] | 240 | ROScalarColumn<Bool> cSigStateCol; |
---|
| 241 | ROScalarColumn<Bool> cRefStateCol; |
---|
| 242 | |
---|
[1325] | 243 | }; |
---|
| 244 | |
---|
| 245 | #endif |
---|