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