| 1 | //#---------------------------------------------------------------------------
|
|---|
| 2 | //# PKSMS2writer.h: Class to write Parkes Multibeam data to a measurementset.
|
|---|
| 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: PKSMS2writer.h,v 19.14 2009-09-29 07:33:38 cal103 Exp $
|
|---|
| 32 | //#---------------------------------------------------------------------------
|
|---|
| 33 |
|
|---|
| 34 | #ifndef ATNF_PKSMS2WRITER_H
|
|---|
| 35 | #define ATNF_PKSMS2WRITER_H
|
|---|
| 36 |
|
|---|
| 37 | #include <atnf/PKSIO/PKSrecord.h>
|
|---|
| 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>
|
|---|
| 44 | #include <casa/BasicSL/String.h>
|
|---|
| 45 | #include <ms/MeasurementSets/MeasurementSet.h>
|
|---|
| 46 | #include <ms/MeasurementSets/MSColumns.h>
|
|---|
| 47 |
|
|---|
| 48 | #include <casa/namespace.h>
|
|---|
| 49 |
|
|---|
| 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,
|
|---|
| 71 | const String bunit,
|
|---|
| 72 | const Float equinox,
|
|---|
| 73 | const String dopplerFrame,
|
|---|
| 74 | const Vector<uInt> nChan,
|
|---|
| 75 | const Vector<uInt> nPol,
|
|---|
| 76 | const Vector<Bool> haveXPol,
|
|---|
| 77 | const Bool haveBase);
|
|---|
| 78 |
|
|---|
| 79 | // Write the next data record.
|
|---|
| 80 | virtual Int write(
|
|---|
| 81 | const PKSrecord &pksrec);
|
|---|
| 82 |
|
|---|
| 83 | // Close the MS, flushing all associated Tables.
|
|---|
| 84 | virtual void close();
|
|---|
| 85 |
|
|---|
| 86 | private:
|
|---|
| 87 | MFrequency::Types cDopplerFrame;
|
|---|
| 88 |
|
|---|
| 89 | // Measurementset main table and subtables.
|
|---|
| 90 | MeasurementSet *cPKSMS;
|
|---|
| 91 | MSAntenna cAntenna;
|
|---|
| 92 | MSDataDescription cDataDescription;
|
|---|
| 93 | MSDoppler cDoppler;
|
|---|
| 94 | MSFeed cFeed;
|
|---|
| 95 | MSField cField;
|
|---|
| 96 | MSFlagCmd cFlagCmd;
|
|---|
| 97 | MSHistory cHistory;
|
|---|
| 98 | MSObservation cObservation;
|
|---|
| 99 | MSPointing cPointing;
|
|---|
| 100 | MSPolarization cPolarization;
|
|---|
| 101 | MSProcessor cProcessor;
|
|---|
| 102 | MSSource cSource;
|
|---|
| 103 | MSSpectralWindow cSpectralWindow;
|
|---|
| 104 | MSState cState;
|
|---|
| 105 | MSSysCal cSysCal;
|
|---|
| 106 | MSWeather cWeather;
|
|---|
| 107 |
|
|---|
| 108 | // Access to measurementset table columns; we are forced to use pointers
|
|---|
| 109 | // here since none of these classes have default constructors.
|
|---|
| 110 | MSColumns *cMSCols;
|
|---|
| 111 | MSAntennaColumns *cAntennaCols;
|
|---|
| 112 | MSDataDescColumns *cDataDescCols;
|
|---|
| 113 | MSDopplerColumns *cDopplerCols;
|
|---|
| 114 | MSFeedColumns *cFeedCols;
|
|---|
| 115 | MSFieldColumns *cFieldCols;
|
|---|
| 116 | MSFlagCmdColumns *cFlagCmdCols;
|
|---|
| 117 | MSHistoryColumns *cHistoryCols;
|
|---|
| 118 | MSObservationColumns *cObservationCols;
|
|---|
| 119 | MSPointingColumns *cPointingCols;
|
|---|
| 120 | MSPolarizationColumns *cPolarizationCols;
|
|---|
| 121 | MSProcessorColumns *cProcessorCols;
|
|---|
| 122 | MSSourceColumns *cSourceCols;
|
|---|
| 123 | MSSpWindowColumns *cSpWindowCols;
|
|---|
| 124 | MSStateColumns *cStateCols;
|
|---|
| 125 | MSSysCalColumns *cSysCalCols;
|
|---|
| 126 | MSWeatherColumns *cWeatherCols;
|
|---|
| 127 |
|
|---|
| 128 | ArrayColumn<Float> *cCalFctrCol;
|
|---|
| 129 | ArrayColumn<Float> *cBaseLinCol;
|
|---|
| 130 | ArrayColumn<Float> *cBaseSubCol;
|
|---|
| 131 | ScalarColumn<Complex> *cXCalFctrCol;
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 | // Add an entry to the ANTENNA subtable.
|
|---|
| 135 | Int addAntennaEntry(
|
|---|
| 136 | const String antName,
|
|---|
| 137 | const Vector<Double> &antPosition);
|
|---|
| 138 |
|
|---|
| 139 | // Add an entry to the DATA_DESCRIPTION subtable.
|
|---|
| 140 | Int addDataDescriptionEntry(
|
|---|
| 141 | const Int iIF);
|
|---|
| 142 |
|
|---|
| 143 | // Add an entry to the DOPPLER subtable.
|
|---|
| 144 | Int addDopplerEntry();
|
|---|
| 145 |
|
|---|
| 146 | // Add an entry to the FEED subtable.
|
|---|
| 147 | Int addFeedEntry();
|
|---|
| 148 |
|
|---|
| 149 | // Add an entry to the FIELD subtable.
|
|---|
| 150 | Int addFieldEntry(
|
|---|
| 151 | const String fieldName,
|
|---|
| 152 | const Double mjd,
|
|---|
| 153 | const Vector<Double> direction,
|
|---|
| 154 | const Vector<Double> scanRate,
|
|---|
| 155 | const Int srcId);
|
|---|
| 156 |
|
|---|
| 157 | // Skip FLAG_CMD subtable.
|
|---|
| 158 |
|
|---|
| 159 | // Skip FREQ_OFFSET subtable.
|
|---|
| 160 |
|
|---|
| 161 | // Skip HISTORY subtable.
|
|---|
| 162 |
|
|---|
| 163 | // Add an entry to the OBSERVATION subtable.
|
|---|
| 164 | Int addObservationEntry(
|
|---|
| 165 | const String observer,
|
|---|
| 166 | const String project);
|
|---|
| 167 |
|
|---|
| 168 | // Add an entry to the POINTING subtable.
|
|---|
| 169 | Int addPointingEntry(
|
|---|
| 170 | const Double mjd,
|
|---|
| 171 | const Double interval,
|
|---|
| 172 | const String fieldName,
|
|---|
| 173 | const Vector<Double> direction,
|
|---|
| 174 | const Vector<Double> scanRate);
|
|---|
| 175 |
|
|---|
| 176 | // Add an entry to the POLARIZATION subtable.
|
|---|
| 177 | Int addPolarizationEntry(
|
|---|
| 178 | const Int iIF,
|
|---|
| 179 | const Int nPol);
|
|---|
| 180 |
|
|---|
| 181 | // Add an entry to the PROCESSOR subtable.
|
|---|
| 182 | Int addProcessorEntry();
|
|---|
| 183 |
|
|---|
| 184 | // Add an entry to the SOURCE subtable.
|
|---|
| 185 | Int addSourceEntry(
|
|---|
| 186 | const String name,
|
|---|
| 187 | const Vector<Double> direction,
|
|---|
| 188 | const Vector<Double> properMotion,
|
|---|
| 189 | const Double restFreq,
|
|---|
| 190 | const Double radialVelocity);
|
|---|
| 191 |
|
|---|
| 192 | // Add an entry to the SPECTRAL_WINDOW subtable.
|
|---|
| 193 | Int addSpectralWindowEntry(
|
|---|
| 194 | const Int iIF,
|
|---|
| 195 | const Int nChan,
|
|---|
| 196 | const Double refFreq,
|
|---|
| 197 | const Double bandwidth,
|
|---|
| 198 | const Double freqInc);
|
|---|
| 199 |
|
|---|
| 200 | // Add an entry to the STATE subtable.
|
|---|
| 201 | Int addStateEntry(
|
|---|
| 202 | const String obsMode);
|
|---|
| 203 |
|
|---|
| 204 | // Add an entry to the SYSCAL subtable.
|
|---|
| 205 | Int addSysCalEntry(
|
|---|
| 206 | const Int beamNo,
|
|---|
| 207 | const Int spWinId,
|
|---|
| 208 | const Double mjd,
|
|---|
| 209 | const Double interval,
|
|---|
| 210 | const Vector<Float> Tcal,
|
|---|
| 211 | const Vector<Float> Tsys);
|
|---|
| 212 |
|
|---|
| 213 | // Add an entry to the WEATHER subtable.
|
|---|
| 214 | Int addWeatherEntry(
|
|---|
| 215 | const Double mjd,
|
|---|
| 216 | const Double interval,
|
|---|
| 217 | const Double pressure,
|
|---|
| 218 | const Double humidity,
|
|---|
| 219 | const Double temperature);
|
|---|
| 220 | };
|
|---|
| 221 |
|
|---|
| 222 | #endif
|
|---|