[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# PKSMS2writer.h: Class to write Parkes Multibeam data to a measurementset. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2000-2006 |
---|
| 5 | //# Associated Universities, Inc. Washington DC, USA. |
---|
| 6 | //# |
---|
| 7 | //# This library is free software; you can redistribute it and/or modify it |
---|
| 8 | //# under the terms of the GNU Library General Public License as published by |
---|
| 9 | //# the Free Software Foundation; either version 2 of the License, or (at your |
---|
| 10 | //# option) any later version. |
---|
| 11 | //# |
---|
| 12 | //# This library is distributed in the hope that it will be useful, but WITHOUT |
---|
| 13 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 14 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
---|
| 15 | //# License for more details. |
---|
| 16 | //# |
---|
| 17 | //# You should have received a copy of the GNU Library General Public License |
---|
| 18 | //# along with this library; if not, write to the Free Software Foundation, |
---|
| 19 | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
---|
| 20 | //# |
---|
| 21 | //# Correspondence concerning AIPS++ should be addressed as follows: |
---|
| 22 | //# Internet email: aips2-request@nrao.edu. |
---|
| 23 | //# Postal address: AIPS++ Project Office |
---|
| 24 | //# National Radio Astronomy Observatory |
---|
| 25 | //# 520 Edgemont Road |
---|
| 26 | //# Charlottesville, VA 22903-2475 USA |
---|
| 27 | //# |
---|
[1393] | 28 | //# $Id$ |
---|
[1325] | 29 | //#--------------------------------------------------------------------------- |
---|
| 30 | |
---|
| 31 | #ifndef ATNF_PKSMS2WRITER_H |
---|
| 32 | #define ATNF_PKSMS2WRITER_H |
---|
| 33 | |
---|
| 34 | #include <atnf/PKSIO/PKSwriter.h> |
---|
| 35 | |
---|
| 36 | #include <casa/aips.h> |
---|
| 37 | #include <casa/Arrays/Matrix.h> |
---|
| 38 | #include <casa/Arrays/Vector.h> |
---|
| 39 | #include <casa/BasicSL/Complex.h> |
---|
| 40 | #include <ms/MeasurementSets/MeasurementSet.h> |
---|
| 41 | #include <ms/MeasurementSets/MSColumns.h> |
---|
| 42 | #include <casa/BasicSL/String.h> |
---|
| 43 | |
---|
| 44 | // <summary> |
---|
| 45 | // Class to write Parkes Multibeam data to a measurementset. |
---|
| 46 | // </summary> |
---|
| 47 | |
---|
| 48 | #include <casa/namespace.h> |
---|
| 49 | class PKSMS2writer : public PKSwriter |
---|
| 50 | { |
---|
| 51 | public: |
---|
| 52 | // Default constructor. |
---|
| 53 | PKSMS2writer(); |
---|
| 54 | |
---|
| 55 | // Destructor. |
---|
| 56 | virtual ~PKSMS2writer(); |
---|
| 57 | |
---|
| 58 | // Create the output MS and write static data. |
---|
| 59 | virtual Int create( |
---|
| 60 | const String msName, |
---|
| 61 | const String observer, |
---|
| 62 | const String project, |
---|
| 63 | const String antName, |
---|
| 64 | const Vector<Double> antPosition, |
---|
| 65 | const String obsMode, |
---|
| 66 | const Float equinox, |
---|
| 67 | const String dopplerFrame, |
---|
| 68 | const Vector<uInt> nChan, |
---|
| 69 | const Vector<uInt> nPol, |
---|
| 70 | const Vector<Bool> haveXPol, |
---|
[1393] | 71 | const Bool haveBase, |
---|
| 72 | const String fluxUnit); |
---|
[1325] | 73 | |
---|
| 74 | // Write the next data record. |
---|
| 75 | virtual Int write( |
---|
| 76 | const Int scanNo, |
---|
| 77 | const Int cycleNo, |
---|
| 78 | const Double mjd, |
---|
| 79 | const Double interval, |
---|
| 80 | const String fieldName, |
---|
| 81 | const String srcName, |
---|
| 82 | const Vector<Double> srcDir, |
---|
| 83 | const Vector<Double> srcPM, |
---|
| 84 | const Double srcVel, |
---|
| 85 | const String obsMode, |
---|
| 86 | const Int IFno, |
---|
| 87 | const Double refFreq, |
---|
| 88 | const Double bandwidth, |
---|
| 89 | const Double freqInc, |
---|
[1453] | 90 | //const Double restFreq, |
---|
| 91 | const Vector<Double> restFreq, |
---|
[1325] | 92 | const Vector<Float> tcal, |
---|
| 93 | const String tcalTime, |
---|
| 94 | const Float azimuth, |
---|
| 95 | const Float elevation, |
---|
| 96 | const Float parAngle, |
---|
| 97 | const Float focusAxi, |
---|
| 98 | const Float focusTan, |
---|
| 99 | const Float focusRot, |
---|
| 100 | const Float temperature, |
---|
| 101 | const Float pressure, |
---|
| 102 | const Float humidity, |
---|
| 103 | const Float windSpeed, |
---|
| 104 | const Float windAz, |
---|
| 105 | const Int refBeam, |
---|
| 106 | const Int beamNo, |
---|
| 107 | const Vector<Double> direction, |
---|
| 108 | const Vector<Double> scanRate, |
---|
| 109 | const Vector<Float> tsys, |
---|
| 110 | const Vector<Float> sigma, |
---|
| 111 | const Vector<Float> calFctr, |
---|
| 112 | const Matrix<Float> baseLin, |
---|
| 113 | const Matrix<Float> baseSub, |
---|
| 114 | const Matrix<Float> &spectra, |
---|
| 115 | const Matrix<uChar> &flagged, |
---|
| 116 | const Complex xCalFctr, |
---|
| 117 | const Vector<Complex> &xPol); |
---|
| 118 | |
---|
| 119 | // Close the MS, flushing all associated Tables. |
---|
| 120 | virtual void close(); |
---|
| 121 | |
---|
| 122 | private: |
---|
| 123 | MFrequency::Types cDopplerFrame; |
---|
| 124 | |
---|
| 125 | // Measurementset main table and subtables. |
---|
| 126 | MeasurementSet *cPKSMS; |
---|
| 127 | MSAntenna cAntenna; |
---|
| 128 | MSDataDescription cDataDescription; |
---|
| 129 | MSDoppler cDoppler; |
---|
| 130 | MSFeed cFeed; |
---|
| 131 | MSField cField; |
---|
| 132 | MSFlagCmd cFlagCmd; |
---|
| 133 | MSHistory cHistory; |
---|
| 134 | MSObservation cObservation; |
---|
| 135 | MSPointing cPointing; |
---|
| 136 | MSPolarization cPolarization; |
---|
| 137 | MSProcessor cProcessor; |
---|
| 138 | MSSource cSource; |
---|
| 139 | MSSpectralWindow cSpectralWindow; |
---|
| 140 | MSState cState; |
---|
| 141 | MSSysCal cSysCal; |
---|
| 142 | MSWeather cWeather; |
---|
| 143 | |
---|
| 144 | // Access to measurementset table columns; we are forced to use pointers |
---|
| 145 | // here since none of these classes have default constructors. |
---|
| 146 | MSColumns *cMSCols; |
---|
| 147 | MSAntennaColumns *cAntennaCols; |
---|
| 148 | MSDataDescColumns *cDataDescCols; |
---|
| 149 | MSDopplerColumns *cDopplerCols; |
---|
| 150 | MSFeedColumns *cFeedCols; |
---|
| 151 | MSFieldColumns *cFieldCols; |
---|
| 152 | MSFlagCmdColumns *cFlagCmdCols; |
---|
| 153 | MSHistoryColumns *cHistoryCols; |
---|
| 154 | MSObservationColumns *cObservationCols; |
---|
| 155 | MSPointingColumns *cPointingCols; |
---|
| 156 | MSPolarizationColumns *cPolarizationCols; |
---|
| 157 | MSProcessorColumns *cProcessorCols; |
---|
| 158 | MSSourceColumns *cSourceCols; |
---|
| 159 | MSSpWindowColumns *cSpWindowCols; |
---|
| 160 | MSStateColumns *cStateCols; |
---|
| 161 | MSSysCalColumns *cSysCalCols; |
---|
| 162 | MSWeatherColumns *cWeatherCols; |
---|
| 163 | |
---|
| 164 | ArrayColumn<Float> *cCalFctrCol; |
---|
| 165 | ArrayColumn<Float> *cBaseLinCol; |
---|
| 166 | ArrayColumn<Float> *cBaseSubCol; |
---|
| 167 | ScalarColumn<Complex> *cXCalFctrCol; |
---|
| 168 | |
---|
[1453] | 169 | // for handling parameters specific to GBT and other telescopes |
---|
[1393] | 170 | Bool cGBT; |
---|
[1453] | 171 | Bool cSMT; |
---|
| 172 | Bool cAPEX; |
---|
| 173 | Bool cALMA; |
---|
[1325] | 174 | |
---|
| 175 | // Add an entry to the ANTENNA subtable. |
---|
| 176 | Int addAntennaEntry( |
---|
| 177 | const String antName, |
---|
| 178 | const Vector<Double> &antPosition); |
---|
| 179 | |
---|
| 180 | // Add an entry to the DATA_DESCRIPTION subtable. |
---|
| 181 | Int addDataDescriptionEntry( |
---|
| 182 | const Int iIF); |
---|
| 183 | |
---|
| 184 | // Add an entry to the DOPPLER subtable. |
---|
| 185 | Int addDopplerEntry(); |
---|
| 186 | |
---|
| 187 | // Add an entry to the FEED subtable. |
---|
| 188 | Int addFeedEntry(); |
---|
| 189 | |
---|
| 190 | // Add an entry to the FIELD subtable. |
---|
| 191 | Int addFieldEntry( |
---|
| 192 | const String fieldName, |
---|
| 193 | const Double mjd, |
---|
| 194 | const Vector<Double> direction, |
---|
| 195 | const Vector<Double> scanRate, |
---|
| 196 | const Int srcId); |
---|
| 197 | |
---|
| 198 | // Skip FLAG_CMD subtable. |
---|
| 199 | |
---|
| 200 | // Skip FREQ_OFFSET subtable. |
---|
| 201 | |
---|
| 202 | // Skip HISTORY subtable. |
---|
| 203 | |
---|
| 204 | // Add an entry to the OBSERVATION subtable. |
---|
| 205 | Int addObservationEntry( |
---|
| 206 | const String observer, |
---|
[1393] | 207 | const String project, |
---|
| 208 | const String antName); |
---|
[1325] | 209 | |
---|
| 210 | // Add an entry to the POINTING subtable. |
---|
| 211 | Int addPointingEntry( |
---|
| 212 | const Double mjd, |
---|
| 213 | const Double interval, |
---|
| 214 | const String fieldName, |
---|
| 215 | const Vector<Double> direction, |
---|
| 216 | const Vector<Double> scanRate); |
---|
| 217 | |
---|
| 218 | // Add an entry to the POLARIZATION subtable. |
---|
| 219 | Int addPolarizationEntry( |
---|
| 220 | const Int iIF, |
---|
| 221 | const Int nPol); |
---|
| 222 | |
---|
| 223 | // Add an entry to the PROCESSOR subtable. |
---|
| 224 | Int addProcessorEntry(); |
---|
| 225 | |
---|
| 226 | // Add an entry to the SOURCE subtable. |
---|
| 227 | Int addSourceEntry( |
---|
| 228 | const String name, |
---|
| 229 | const Vector<Double> direction, |
---|
| 230 | const Vector<Double> properMotion, |
---|
[1453] | 231 | //const Double restFreq, |
---|
| 232 | const Vector<Double> restFreq, |
---|
[1325] | 233 | const Double radialVelocity); |
---|
| 234 | |
---|
| 235 | // Add an entry to the SPECTRAL_WINDOW subtable. |
---|
| 236 | Int addSpectralWindowEntry( |
---|
| 237 | const Int iIF, |
---|
| 238 | const Int nChan, |
---|
| 239 | const Double refFreq, |
---|
| 240 | const Double bandwidth, |
---|
| 241 | const Double freqInc); |
---|
| 242 | |
---|
| 243 | // Add an entry to the STATE subtable. |
---|
| 244 | Int addStateEntry( |
---|
| 245 | const String obsMode); |
---|
| 246 | |
---|
| 247 | // Add an entry to the SYSCAL subtable. |
---|
| 248 | Int addSysCalEntry( |
---|
| 249 | const Int beamNo, |
---|
| 250 | const Int spWinId, |
---|
| 251 | const Double mjd, |
---|
| 252 | const Double interval, |
---|
| 253 | const Vector<Float> Tcal, |
---|
[1393] | 254 | const Vector<Float> Tsys, |
---|
| 255 | const Int nPol); |
---|
[1325] | 256 | |
---|
| 257 | // Add an entry to the WEATHER subtable. |
---|
| 258 | Int addWeatherEntry( |
---|
| 259 | const Double mjd, |
---|
| 260 | const Double interval, |
---|
| 261 | const Double pressure, |
---|
| 262 | const Double humidity, |
---|
| 263 | const Double temperature); |
---|
| 264 | }; |
---|
| 265 | |
---|
| 266 | #endif |
---|