| [1325] | 1 | //#--------------------------------------------------------------------------- | 
|---|
|  | 2 | //# PKSreader.h: Class to read Parkes multibeam data. | 
|---|
|  | 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: PKSreader.h,v 19.24 2009-09-29 07:33:39 cal103 Exp $ | 
|---|
| [1325] | 32 | //#--------------------------------------------------------------------------- | 
|---|
|  | 33 | //# Original: 2000/08/02, Mark Calabretta, ATNF | 
|---|
|  | 34 | //#--------------------------------------------------------------------------- | 
|---|
|  | 35 |  | 
|---|
|  | 36 | #ifndef ATNF_PKSREADER_H | 
|---|
|  | 37 | #define ATNF_PKSREADER_H | 
|---|
|  | 38 |  | 
|---|
| [1452] | 39 | #include <atnf/PKSIO/PKSrecord.h> | 
|---|
| [1779] | 40 | #include <atnf/PKSIO/SrcType.h> | 
|---|
| [1452] | 41 |  | 
|---|
| [1325] | 42 | #include <casa/aips.h> | 
|---|
|  | 43 | #include <casa/Arrays/Matrix.h> | 
|---|
|  | 44 | #include <casa/Arrays/Vector.h> | 
|---|
| [1779] | 45 | #include <casa/BasicSL/Complex.h> | 
|---|
| [1325] | 46 | #include <casa/BasicSL/String.h> | 
|---|
|  | 47 |  | 
|---|
| [1427] | 48 | #include <casa/namespace.h> | 
|---|
|  | 49 |  | 
|---|
| [1325] | 50 | // <summary> | 
|---|
|  | 51 | // Class to read Parkes multibeam data. | 
|---|
|  | 52 | // </summary> | 
|---|
|  | 53 |  | 
|---|
| [1452] | 54 | // Return an appropriate PKSreader for a Parkes Multibeam dataset. | 
|---|
|  | 55 | class PKSreader* getPKSreader( | 
|---|
|  | 56 | const String name, | 
|---|
|  | 57 | const Int retry, | 
|---|
|  | 58 | const Int interpolate, | 
|---|
|  | 59 | String &format); | 
|---|
|  | 60 |  | 
|---|
|  | 61 | // As above, but search a list of directories for it. | 
|---|
|  | 62 | class PKSreader* getPKSreader( | 
|---|
|  | 63 | const String name, | 
|---|
|  | 64 | const Vector<String> directories, | 
|---|
|  | 65 | const Int retry, | 
|---|
|  | 66 | const Int interpolate, | 
|---|
|  | 67 | Int    &iDir, | 
|---|
|  | 68 | String &format); | 
|---|
|  | 69 |  | 
|---|
| [1325] | 70 | // Open an appropriate PKSreader for a Parkes Multibeam dataset. | 
|---|
|  | 71 | class PKSreader* getPKSreader( | 
|---|
|  | 72 | const String name, | 
|---|
| [1779] | 73 | const String antenna, | 
|---|
| [1325] | 74 | const Int retry, | 
|---|
|  | 75 | const Int interpolate, | 
|---|
|  | 76 | String &format, | 
|---|
|  | 77 | Vector<Bool> &beams, | 
|---|
|  | 78 | Vector<Bool> &IFs, | 
|---|
|  | 79 | Vector<uInt> &nChan, | 
|---|
|  | 80 | Vector<uInt> &nPol, | 
|---|
|  | 81 | Vector<Bool> &haveXPol, | 
|---|
|  | 82 | Bool   &haveBase, | 
|---|
|  | 83 | Bool   &haveSpectra); | 
|---|
|  | 84 |  | 
|---|
|  | 85 | // As above, but search a list of directories for it. | 
|---|
|  | 86 | class PKSreader* getPKSreader( | 
|---|
|  | 87 | const String name, | 
|---|
| [1779] | 88 | const String antenna, | 
|---|
| [1325] | 89 | const Vector<String> directories, | 
|---|
|  | 90 | const Int retry, | 
|---|
|  | 91 | const Int interpolate, | 
|---|
|  | 92 | Int    &iDir, | 
|---|
|  | 93 | String &format, | 
|---|
|  | 94 | Vector<Bool> &beams, | 
|---|
|  | 95 | Vector<Bool> &IFs, | 
|---|
|  | 96 | Vector<uInt> &nChan, | 
|---|
|  | 97 | Vector<uInt> &nPol, | 
|---|
|  | 98 | Vector<Bool> &haveXPol, | 
|---|
|  | 99 | Bool   &haveBase, | 
|---|
|  | 100 | Bool   &haveSpectra); | 
|---|
|  | 101 |  | 
|---|
| [1779] | 102 |  | 
|---|
|  | 103 | class PKSreader | 
|---|
| [1325] | 104 | { | 
|---|
|  | 105 | public: | 
|---|
|  | 106 | // Destructor. | 
|---|
|  | 107 | virtual ~PKSreader() {}; | 
|---|
|  | 108 |  | 
|---|
|  | 109 | // Open the dataset. | 
|---|
|  | 110 | virtual Int open( | 
|---|
|  | 111 | const String inName, | 
|---|
| [1779] | 112 | const String antenna, | 
|---|
| [1325] | 113 | Vector<Bool> &beams, | 
|---|
|  | 114 | Vector<Bool> &IFs, | 
|---|
|  | 115 | Vector<uInt> &nChan, | 
|---|
|  | 116 | Vector<uInt> &nPol, | 
|---|
|  | 117 | Vector<Bool> &haveXPol, | 
|---|
|  | 118 | Bool   &haveBase, | 
|---|
|  | 119 | Bool   &haveSpectra) = 0; | 
|---|
|  | 120 |  | 
|---|
|  | 121 | // Get parameters describing the data. | 
|---|
|  | 122 | virtual Int getHeader( | 
|---|
|  | 123 | String &observer, | 
|---|
|  | 124 | String &project, | 
|---|
|  | 125 | String &antName, | 
|---|
|  | 126 | Vector<Double> &antPosition, | 
|---|
|  | 127 | String &obsType, | 
|---|
| [1399] | 128 | String &bunit, | 
|---|
| [1325] | 129 | Float  &equinox, | 
|---|
|  | 130 | String &dopplerFrame, | 
|---|
|  | 131 | Double &mjd, | 
|---|
|  | 132 | Double &refFreq, | 
|---|
|  | 133 | Double &bandwidth) = 0; | 
|---|
|  | 134 |  | 
|---|
|  | 135 | // Get frequency parameters for each IF. | 
|---|
|  | 136 | virtual Int getFreqInfo( | 
|---|
|  | 137 | Vector<Double> &startFreq, | 
|---|
|  | 138 | Vector<Double> &endFreq) = 0; | 
|---|
|  | 139 |  | 
|---|
|  | 140 | // Set data selection criteria.  Channel numbering is 1-relative, zero or | 
|---|
|  | 141 | // negative channel numbers are taken to be offsets from the last channel. | 
|---|
| [1452] | 142 | // Coordinate system selection (only supported for SDFITS input): | 
|---|
|  | 143 | //   0: equatorial (RA,Dec), | 
|---|
| [1635] | 144 | //   1: horizontal (Az,El), | 
|---|
|  | 145 | //   2: feed-plane, | 
|---|
|  | 146 | //   3: zenithal position angle of feed and elevation, (ZPA,El). | 
|---|
| [1325] | 147 | virtual uInt select( | 
|---|
|  | 148 | const Vector<Bool> beamSel, | 
|---|
|  | 149 | const Vector<Bool> IFsel, | 
|---|
|  | 150 | const Vector<Int>  startChan, | 
|---|
|  | 151 | const Vector<Int>  endChan, | 
|---|
|  | 152 | const Vector<Int>  refChan, | 
|---|
|  | 153 | const Bool getSpectra = True, | 
|---|
|  | 154 | const Bool getXPol    = False, | 
|---|
| [1779] | 155 | const Bool getFeedPos = False, | 
|---|
|  | 156 | const Bool getPointing = False, | 
|---|
| [1452] | 157 | const Int  coordSys   = 0) = 0; | 
|---|
| [1325] | 158 |  | 
|---|
| [1779] | 159 |  | 
|---|
| [1325] | 160 | // Find the range of the data selected in time and position. | 
|---|
|  | 161 | virtual Int findRange( | 
|---|
|  | 162 | Int    &nRow, | 
|---|
|  | 163 | Int    &nSel, | 
|---|
|  | 164 | Vector<Double> &timeSpan, | 
|---|
|  | 165 | Matrix<Double> &positions) = 0; | 
|---|
|  | 166 |  | 
|---|
| [1779] | 167 | // Read the next data record. | 
|---|
|  | 168 | /** | 
|---|
|  | 169 | virtual Int read( | 
|---|
|  | 170 | Int             &scanNo, | 
|---|
|  | 171 | Int             &cycleNo, | 
|---|
|  | 172 | Double          &mjd, | 
|---|
|  | 173 | Double          &interval, | 
|---|
|  | 174 | String          &fieldName, | 
|---|
|  | 175 | String          &srcName, | 
|---|
|  | 176 | Vector<Double>  &srcDir, | 
|---|
|  | 177 | Vector<Double>  &srcPM, | 
|---|
|  | 178 | Double          &srcVel, | 
|---|
|  | 179 | String          &obsType, | 
|---|
|  | 180 | Int             &IFno, | 
|---|
|  | 181 | Double          &refFreq, | 
|---|
|  | 182 | Double          &bandwidth, | 
|---|
|  | 183 | Double          &freqInc, | 
|---|
|  | 184 | Vector<Double>  &restFreq, | 
|---|
|  | 185 | Vector<Float>   &tcal, | 
|---|
|  | 186 | String          &tcalTime, | 
|---|
|  | 187 | Float           &azimuth, | 
|---|
|  | 188 | Float           &elevation, | 
|---|
|  | 189 | Float           &parAngle, | 
|---|
|  | 190 | Float           &focusAxi, | 
|---|
|  | 191 | Float           &focusTan, | 
|---|
|  | 192 | Float           &focusRot, | 
|---|
|  | 193 | Float           &temperature, | 
|---|
|  | 194 | Float           &pressure, | 
|---|
|  | 195 | Float           &humidity, | 
|---|
|  | 196 | Float           &windSpeed, | 
|---|
|  | 197 | Float           &windAz, | 
|---|
|  | 198 | Int             &refBeam, | 
|---|
|  | 199 | Int             &beamNo, | 
|---|
|  | 200 | Vector<Double>  &direction, | 
|---|
|  | 201 | Vector<Double>  &scanRate, | 
|---|
|  | 202 | Vector<Float>   &tsys, | 
|---|
|  | 203 | Vector<Float>   &sigma, | 
|---|
|  | 204 | Vector<Float>   &calFctr, | 
|---|
|  | 205 | Matrix<Float>   &baseLin, | 
|---|
|  | 206 | Matrix<Float>   &baseSub, | 
|---|
|  | 207 | Matrix<Float>   &spectra, | 
|---|
|  | 208 | Matrix<uChar>   &flagged, | 
|---|
|  | 209 | Complex         &xCalFctr, | 
|---|
|  | 210 | Vector<Complex> &xPol) = 0; | 
|---|
|  | 211 | **/ | 
|---|
|  | 212 | /** | 
|---|
|  | 213 | // Read the next data record, just the basics. | 
|---|
|  | 214 | virtual Int read( | 
|---|
|  | 215 | Int           &IFno, | 
|---|
|  | 216 | Vector<Float> &tsys, | 
|---|
|  | 217 | Vector<Float> &calFctr, | 
|---|
|  | 218 | Matrix<Float> &baseLin, | 
|---|
|  | 219 | Matrix<Float> &baseSub, | 
|---|
|  | 220 | Matrix<Float> &spectra, | 
|---|
|  | 221 | Matrix<uChar> &flagged) = 0; | 
|---|
|  | 222 | **/ | 
|---|
| [1452] | 223 | virtual Int read(PKSrecord &pksrec) = 0; | 
|---|
| [1427] | 224 |  | 
|---|
| [1325] | 225 | // Close the input file. | 
|---|
|  | 226 | virtual void close() = 0; | 
|---|
|  | 227 |  | 
|---|
|  | 228 | protected: | 
|---|
| [1779] | 229 | Bool   cGetFeedPos, cGetSpectra, cGetXPol, cGetPointing; | 
|---|
| [1452] | 230 | Int   cCoordSys; | 
|---|
| [1325] | 231 |  | 
|---|
|  | 232 | Vector<uInt> cNChan, cNPol; | 
|---|
|  | 233 | Vector<Bool> cHaveXPol; | 
|---|
|  | 234 | }; | 
|---|
|  | 235 |  | 
|---|
|  | 236 | #endif | 
|---|