source: branches/alma/external/atnf/PKSIO/PKSMS2writer.h @ 1393

Last change on this file since 1393 was 1393, checked in by TakTsutsumi, 17 years ago

Changes to handle GBT MS data

File size: 8.1 KB
Line 
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//#
28//# $Id$
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>
49class 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,
71        const Bool   haveBase,
72        const String fluxUnit);
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,
90        const Double          restFreq,
91        const Vector<Float>   tcal,
92        const String          tcalTime,
93        const Float           azimuth,
94        const Float           elevation,
95        const Float           parAngle,
96        const Float           focusAxi,
97        const Float           focusTan,
98        const Float           focusRot,
99        const Float           temperature,
100        const Float           pressure,
101        const Float           humidity,
102        const Float           windSpeed,
103        const Float           windAz,
104        const Int             refBeam,
105        const Int             beamNo,
106        const Vector<Double>  direction,
107        const Vector<Double>  scanRate,
108        const Vector<Float>   tsys,
109        const Vector<Float>   sigma,
110        const Vector<Float>   calFctr,
111        const Matrix<Float>   baseLin,
112        const Matrix<Float>   baseSub,
113        const Matrix<Float>   &spectra,
114        const Matrix<uChar>   &flagged,
115        const Complex         xCalFctr,
116        const Vector<Complex> &xPol);
117
118    // Close the MS, flushing all associated Tables.
119    virtual void close();
120
121  private:
122    MFrequency::Types cDopplerFrame;
123
124    // Measurementset main table and subtables.
125    MeasurementSet *cPKSMS;
126    MSAntenna cAntenna;
127    MSDataDescription cDataDescription;
128    MSDoppler cDoppler;
129    MSFeed cFeed;
130    MSField cField;
131    MSFlagCmd cFlagCmd;
132    MSHistory cHistory;
133    MSObservation cObservation;
134    MSPointing cPointing;
135    MSPolarization cPolarization;
136    MSProcessor cProcessor;
137    MSSource cSource;
138    MSSpectralWindow cSpectralWindow;
139    MSState cState;
140    MSSysCal cSysCal;
141    MSWeather cWeather;
142
143    // Access to measurementset table columns; we are forced to use pointers
144    // here since none of these classes have default constructors.
145    MSColumns *cMSCols;
146    MSAntennaColumns *cAntennaCols;
147    MSDataDescColumns *cDataDescCols;
148    MSDopplerColumns *cDopplerCols;
149    MSFeedColumns *cFeedCols;
150    MSFieldColumns *cFieldCols;
151    MSFlagCmdColumns *cFlagCmdCols;
152    MSHistoryColumns *cHistoryCols;
153    MSObservationColumns *cObservationCols;
154    MSPointingColumns *cPointingCols;
155    MSPolarizationColumns *cPolarizationCols;
156    MSProcessorColumns *cProcessorCols;
157    MSSourceColumns *cSourceCols;
158    MSSpWindowColumns *cSpWindowCols;
159    MSStateColumns *cStateCols;
160    MSSysCalColumns *cSysCalCols;
161    MSWeatherColumns *cWeatherCols;
162
163    ArrayColumn<Float> *cCalFctrCol;
164    ArrayColumn<Float> *cBaseLinCol;
165    ArrayColumn<Float> *cBaseSubCol;
166    ScalarColumn<Complex> *cXCalFctrCol;
167
168    // for GBT specific data handling
169    Bool cGBT;
170
171    // Add an entry to the ANTENNA subtable.
172    Int addAntennaEntry(
173        const String antName,
174        const Vector<Double> &antPosition);
175
176    // Add an entry to the DATA_DESCRIPTION subtable.
177    Int addDataDescriptionEntry(
178        const Int iIF);
179
180    // Add an entry to the DOPPLER subtable.
181    Int addDopplerEntry();
182
183    // Add an entry to the FEED subtable.
184    Int addFeedEntry();
185
186    // Add an entry to the FIELD subtable.
187    Int addFieldEntry(
188        const String fieldName,
189        const Double mjd,
190        const Vector<Double> direction,
191        const Vector<Double> scanRate,
192        const Int srcId);
193
194    // Skip FLAG_CMD subtable.
195
196    // Skip FREQ_OFFSET subtable.
197
198    // Skip HISTORY subtable.
199
200    // Add an entry to the OBSERVATION subtable.
201    Int addObservationEntry(
202        const String observer,
203        const String project,
204        const String antName);
205
206    // Add an entry to the POINTING subtable.
207    Int addPointingEntry(
208        const Double mjd,
209        const Double interval,
210        const String fieldName,
211        const Vector<Double> direction,
212        const Vector<Double> scanRate);
213
214    // Add an entry to the POLARIZATION subtable.
215    Int addPolarizationEntry(
216        const Int iIF,
217        const Int nPol);
218
219    // Add an entry to the PROCESSOR subtable.
220    Int addProcessorEntry();
221
222    // Add an entry to the SOURCE subtable.
223    Int addSourceEntry(
224        const String name,
225        const Vector<Double> direction,
226        const Vector<Double> properMotion,
227        const Double restFreq,
228        const Double radialVelocity);
229
230    // Add an entry to the SPECTRAL_WINDOW subtable.
231    Int addSpectralWindowEntry(
232        const Int iIF,
233        const Int nChan,
234        const Double refFreq,
235        const Double bandwidth,
236        const Double freqInc);
237
238    // Add an entry to the STATE subtable.
239    Int addStateEntry(
240        const String obsMode);
241
242    // Add an entry to the SYSCAL subtable.
243    Int addSysCalEntry(
244        const Int beamNo,
245        const Int spWinId,
246        const Double mjd,
247        const Double interval,
248        const Vector<Float> Tcal,
249        const Vector<Float> Tsys,
250        const Int nPol);
251
252    // Add an entry to the WEATHER subtable.
253    Int addWeatherEntry(
254        const Double mjd,
255        const Double interval,
256        const Double pressure,
257        const Double humidity,
258        const Double temperature);
259};
260
261#endif
Note: See TracBrowser for help on using the repository browser.