[1325] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# PKSMS2writer.h: Class to write Parkes Multibeam data to a measurementset.
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
[1757] | 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
|
---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
|
---|
[1325] | 6 | //#
|
---|
[1757] | 7 | //# This file is part of livedata.
|
---|
[1325] | 8 | //#
|
---|
[1757] | 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
|
---|
[1757] | 16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
| 17 | //# more details.
|
---|
[1325] | 18 | //#
|
---|
[1757] | 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 | //#
|
---|
[1757] | 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 | //#
|
---|
[1757] | 30 | //# http://www.atnf.csiro.au/computing/software/livedata.html
|
---|
| 31 | //# $Id: PKSMS2writer.h,v 19.14 2009-09-29 07:33:38 cal103 Exp $
|
---|
[1325] | 32 | //#---------------------------------------------------------------------------
|
---|
| 33 |
|
---|
| 34 | #ifndef ATNF_PKSMS2WRITER_H
|
---|
| 35 | #define ATNF_PKSMS2WRITER_H
|
---|
| 36 |
|
---|
[1757] | 37 | #include <atnf/PKSIO/PKSrecord.h>
|
---|
[1325] | 38 | #include <atnf/PKSIO/PKSwriter.h>
|
---|
| 39 |
|
---|
| 40 | #include <casa/aips.h>
|
---|
| 41 | #include <casa/Arrays/Matrix.h>
|
---|
| 42 | #include <casa/Arrays/Vector.h>
|
---|
| 43 | #include <casa/BasicSL/Complex.h>
|
---|
[1757] | 44 | #include <casa/BasicSL/String.h>
|
---|
[1325] | 45 | #include <ms/MeasurementSets/MeasurementSet.h>
|
---|
| 46 | #include <ms/MeasurementSets/MSColumns.h>
|
---|
| 47 |
|
---|
[1757] | 48 | #include <casa/namespace.h>
|
---|
| 49 |
|
---|
[1325] | 50 | // <summary>
|
---|
| 51 | // Class to write Parkes Multibeam data to a measurementset.
|
---|
| 52 | // </summary>
|
---|
| 53 |
|
---|
| 54 | class PKSMS2writer : public PKSwriter
|
---|
| 55 | {
|
---|
| 56 | public:
|
---|
| 57 | // Default constructor.
|
---|
| 58 | PKSMS2writer();
|
---|
| 59 |
|
---|
| 60 | // Destructor.
|
---|
| 61 | virtual ~PKSMS2writer();
|
---|
| 62 |
|
---|
| 63 | // Create the output MS and write static data.
|
---|
| 64 | virtual Int create(
|
---|
| 65 | const String msName,
|
---|
| 66 | const String observer,
|
---|
| 67 | const String project,
|
---|
| 68 | const String antName,
|
---|
| 69 | const Vector<Double> antPosition,
|
---|
| 70 | const String obsMode,
|
---|
[1757] | 71 | const String bunit,
|
---|
[1325] | 72 | const Float equinox,
|
---|
| 73 | const String dopplerFrame,
|
---|
| 74 | const Vector<uInt> nChan,
|
---|
| 75 | const Vector<uInt> nPol,
|
---|
| 76 | const Vector<Bool> haveXPol,
|
---|
[1757] | 77 | const Bool haveBase);
|
---|
[1325] | 78 |
|
---|
| 79 | // Write the next data record.
|
---|
[1757] | 80 | /**
|
---|
[1325] | 81 | virtual Int write(
|
---|
| 82 | const Int scanNo,
|
---|
| 83 | const Int cycleNo,
|
---|
| 84 | const Double mjd,
|
---|
| 85 | const Double interval,
|
---|
| 86 | const String fieldName,
|
---|
| 87 | const String srcName,
|
---|
| 88 | const Vector<Double> srcDir,
|
---|
| 89 | const Vector<Double> srcPM,
|
---|
| 90 | const Double srcVel,
|
---|
| 91 | const String obsMode,
|
---|
| 92 | const Int IFno,
|
---|
| 93 | const Double refFreq,
|
---|
| 94 | const Double bandwidth,
|
---|
| 95 | const Double freqInc,
|
---|
[1453] | 96 | //const Double restFreq,
|
---|
| 97 | const Vector<Double> restFreq,
|
---|
[1325] | 98 | const Vector<Float> tcal,
|
---|
| 99 | const String tcalTime,
|
---|
| 100 | const Float azimuth,
|
---|
| 101 | const Float elevation,
|
---|
| 102 | const Float parAngle,
|
---|
| 103 | const Float focusAxi,
|
---|
| 104 | const Float focusTan,
|
---|
| 105 | const Float focusRot,
|
---|
| 106 | const Float temperature,
|
---|
| 107 | const Float pressure,
|
---|
| 108 | const Float humidity,
|
---|
| 109 | const Float windSpeed,
|
---|
| 110 | const Float windAz,
|
---|
| 111 | const Int refBeam,
|
---|
| 112 | const Int beamNo,
|
---|
| 113 | const Vector<Double> direction,
|
---|
| 114 | const Vector<Double> scanRate,
|
---|
| 115 | const Vector<Float> tsys,
|
---|
| 116 | const Vector<Float> sigma,
|
---|
| 117 | const Vector<Float> calFctr,
|
---|
| 118 | const Matrix<Float> baseLin,
|
---|
| 119 | const Matrix<Float> baseSub,
|
---|
| 120 | const Matrix<Float> &spectra,
|
---|
| 121 | const Matrix<uChar> &flagged,
|
---|
[1757] | 122 | const uInt flagrow,
|
---|
[1325] | 123 | const Complex xCalFctr,
|
---|
| 124 | const Vector<Complex> &xPol);
|
---|
[1757] | 125 | **/
|
---|
| 126 | virtual Int write(
|
---|
| 127 | const PKSrecord &pksrec);
|
---|
[1325] | 128 |
|
---|
| 129 | // Close the MS, flushing all associated Tables.
|
---|
| 130 | virtual void close();
|
---|
| 131 |
|
---|
| 132 | private:
|
---|
| 133 | MFrequency::Types cDopplerFrame;
|
---|
| 134 |
|
---|
| 135 | // Measurementset main table and subtables.
|
---|
| 136 | MeasurementSet *cPKSMS;
|
---|
| 137 | MSAntenna cAntenna;
|
---|
| 138 | MSDataDescription cDataDescription;
|
---|
| 139 | MSDoppler cDoppler;
|
---|
| 140 | MSFeed cFeed;
|
---|
| 141 | MSField cField;
|
---|
| 142 | MSFlagCmd cFlagCmd;
|
---|
| 143 | MSHistory cHistory;
|
---|
| 144 | MSObservation cObservation;
|
---|
| 145 | MSPointing cPointing;
|
---|
| 146 | MSPolarization cPolarization;
|
---|
| 147 | MSProcessor cProcessor;
|
---|
| 148 | MSSource cSource;
|
---|
| 149 | MSSpectralWindow cSpectralWindow;
|
---|
| 150 | MSState cState;
|
---|
| 151 | MSSysCal cSysCal;
|
---|
| 152 | MSWeather cWeather;
|
---|
| 153 |
|
---|
| 154 | // Access to measurementset table columns; we are forced to use pointers
|
---|
| 155 | // here since none of these classes have default constructors.
|
---|
| 156 | MSColumns *cMSCols;
|
---|
| 157 | MSAntennaColumns *cAntennaCols;
|
---|
| 158 | MSDataDescColumns *cDataDescCols;
|
---|
| 159 | MSDopplerColumns *cDopplerCols;
|
---|
| 160 | MSFeedColumns *cFeedCols;
|
---|
| 161 | MSFieldColumns *cFieldCols;
|
---|
| 162 | MSFlagCmdColumns *cFlagCmdCols;
|
---|
| 163 | MSHistoryColumns *cHistoryCols;
|
---|
| 164 | MSObservationColumns *cObservationCols;
|
---|
| 165 | MSPointingColumns *cPointingCols;
|
---|
| 166 | MSPolarizationColumns *cPolarizationCols;
|
---|
| 167 | MSProcessorColumns *cProcessorCols;
|
---|
| 168 | MSSourceColumns *cSourceCols;
|
---|
| 169 | MSSpWindowColumns *cSpWindowCols;
|
---|
| 170 | MSStateColumns *cStateCols;
|
---|
| 171 | MSSysCalColumns *cSysCalCols;
|
---|
| 172 | MSWeatherColumns *cWeatherCols;
|
---|
| 173 |
|
---|
| 174 | ArrayColumn<Float> *cCalFctrCol;
|
---|
| 175 | ArrayColumn<Float> *cBaseLinCol;
|
---|
| 176 | ArrayColumn<Float> *cBaseSubCol;
|
---|
| 177 | ScalarColumn<Complex> *cXCalFctrCol;
|
---|
| 178 |
|
---|
[1453] | 179 | // for handling parameters specific to GBT and other telescopes
|
---|
[1757] | 180 | Bool cGBT, cSMT, cAPEX, cALMA, cATF;
|
---|
[1325] | 181 |
|
---|
| 182 | // Add an entry to the ANTENNA subtable.
|
---|
| 183 | Int addAntennaEntry(
|
---|
| 184 | const String antName,
|
---|
| 185 | const Vector<Double> &antPosition);
|
---|
| 186 |
|
---|
| 187 | // Add an entry to the DATA_DESCRIPTION subtable.
|
---|
| 188 | Int addDataDescriptionEntry(
|
---|
| 189 | const Int iIF);
|
---|
| 190 |
|
---|
| 191 | // Add an entry to the DOPPLER subtable.
|
---|
| 192 | Int addDopplerEntry();
|
---|
| 193 |
|
---|
| 194 | // Add an entry to the FEED subtable.
|
---|
| 195 | Int addFeedEntry();
|
---|
| 196 |
|
---|
| 197 | // Add an entry to the FIELD subtable.
|
---|
| 198 | Int addFieldEntry(
|
---|
| 199 | const String fieldName,
|
---|
| 200 | const Double mjd,
|
---|
| 201 | const Vector<Double> direction,
|
---|
| 202 | const Vector<Double> scanRate,
|
---|
| 203 | const Int srcId);
|
---|
| 204 |
|
---|
| 205 | // Skip FLAG_CMD subtable.
|
---|
| 206 |
|
---|
| 207 | // Skip FREQ_OFFSET subtable.
|
---|
| 208 |
|
---|
| 209 | // Skip HISTORY subtable.
|
---|
| 210 |
|
---|
| 211 | // Add an entry to the OBSERVATION subtable.
|
---|
| 212 | Int addObservationEntry(
|
---|
| 213 | const String observer,
|
---|
[1393] | 214 | const String project,
|
---|
| 215 | const String antName);
|
---|
[1325] | 216 |
|
---|
| 217 | // Add an entry to the POINTING subtable.
|
---|
| 218 | Int addPointingEntry(
|
---|
| 219 | const Double mjd,
|
---|
| 220 | const Double interval,
|
---|
| 221 | const String fieldName,
|
---|
| 222 | const Vector<Double> direction,
|
---|
| 223 | const Vector<Double> scanRate);
|
---|
| 224 |
|
---|
| 225 | // Add an entry to the POLARIZATION subtable.
|
---|
| 226 | Int addPolarizationEntry(
|
---|
| 227 | const Int iIF,
|
---|
| 228 | const Int nPol);
|
---|
| 229 |
|
---|
| 230 | // Add an entry to the PROCESSOR subtable.
|
---|
| 231 | Int addProcessorEntry();
|
---|
| 232 |
|
---|
| 233 | // Add an entry to the SOURCE subtable.
|
---|
| 234 | Int addSourceEntry(
|
---|
| 235 | const String name,
|
---|
| 236 | const Vector<Double> direction,
|
---|
| 237 | const Vector<Double> properMotion,
|
---|
[1453] | 238 | //const Double restFreq,
|
---|
| 239 | const Vector<Double> restFreq,
|
---|
[1325] | 240 | const Double radialVelocity);
|
---|
| 241 |
|
---|
| 242 | // Add an entry to the SPECTRAL_WINDOW subtable.
|
---|
| 243 | Int addSpectralWindowEntry(
|
---|
| 244 | const Int iIF,
|
---|
| 245 | const Int nChan,
|
---|
| 246 | const Double refFreq,
|
---|
| 247 | const Double bandwidth,
|
---|
| 248 | const Double freqInc);
|
---|
| 249 |
|
---|
| 250 | // Add an entry to the STATE subtable.
|
---|
| 251 | Int addStateEntry(
|
---|
| 252 | const String obsMode);
|
---|
| 253 |
|
---|
| 254 | // Add an entry to the SYSCAL subtable.
|
---|
| 255 | Int addSysCalEntry(
|
---|
| 256 | const Int beamNo,
|
---|
| 257 | const Int spWinId,
|
---|
| 258 | const Double mjd,
|
---|
| 259 | const Double interval,
|
---|
| 260 | const Vector<Float> Tcal,
|
---|
[1393] | 261 | const Vector<Float> Tsys,
|
---|
| 262 | const Int nPol);
|
---|
[1325] | 263 |
|
---|
| 264 | // Add an entry to the WEATHER subtable.
|
---|
| 265 | Int addWeatherEntry(
|
---|
| 266 | const Double mjd,
|
---|
| 267 | const Double interval,
|
---|
| 268 | const Double pressure,
|
---|
| 269 | const Double humidity,
|
---|
| 270 | const Double temperature);
|
---|
| 271 | };
|
---|
| 272 |
|
---|
| 273 | #endif
|
---|