source: trunk/external-alma/atnf/PKSIO/NRODataset.h@ 2341

Last change on this file since 2341 was 2289, checked in by ShinnosukeKawakami, 13 years ago

merged parallel branch to trunk

File size: 13.4 KB
RevLine 
[1757]1//#---------------------------------------------------------------------------
2//# NRODataset.h: Base class for NRO dataset.
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//# Original: 2009/02/27, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#ifndef NRO_DATASET_H
34#define NRO_DATASET_H
35
36#include <string>
37#include <stdio.h>
38#include <vector>
39#include <iostream>
40
41//#include <casa/aips.h>
42#include <casa/Logging/LogIO.h>
[2198]43#include <casa/Containers/Record.h>
[1757]44#include <atnf/PKSIO/NRODataRecord.h>
45#include <casa/namespace.h>
46
47#define SCAN_HEADER_SIZE 424
48
49
50using namespace std ;
51
52// <summary>
53// Base class for NRO accessor classes.
54// </summary>
55//
56// <prerequisite>
57// <li> <linkto class=NROReader>NROReader</linkto>
58// <li> <linkto class=NRODataRecord>NRODataRecord</linkto>
59// </prerequisite>
60//
61// <reviewed reviewer="" date="" tests="" demos="">
62// </reviewed>
63//
64// <etymology>
65// This class is a base class for classes that actually access data from NRO telescopes.
66// Concrete classes are defiened for each data type (OTF format or NRO FITS) and/or
67// telescopes (45m or ASTE).
68// The class have two filler method: fillHeader and fillRecord. The former reads header
69// information from the data. Since header data depends on the telescope and its configuration,
70// it is an abstract in this class and is defined in each concrete class.
71// On the other hand, the later reads each scan record (set of meta data
72// and spectral data). The method uses <linkto class=NRODataRecord>NRODataRecord</linkto>
73// to access scan record. It is implemented here since contents of scan record is
74// quite similar for several types of data.
75// </etymology>
76//
77// <synopsis>
78// Abstract class that is designed as a base class for all accessor classes.
79// </synopsis>
80//
81
82class NRODataset
83{
84 public:
85 // Constructor
86 NRODataset( string name ) ;
87
88 // Destructor
89 virtual ~NRODataset() ;
90
91 // Data initialization
92 virtual void initialize() ;
93
94 // open file
95 virtual int open() ;
96
97 // close file
98 virtual void close() ;
99
100 // Fill data header from file
101 virtual int fillHeader() = 0 ;
102
103 // Fill data record
104 virtual int fillRecord( int i ) ;
105
106 // simple getter
107 string getLOFIL() { return LOFIL ; } ;
108 string getVER() { return VER ; } ;
109 string getGROUP() { return GROUP ; } ;
110 string getPROJ() { return PROJ ; } ;
111 string getSCHED() { return SCHED ; } ;
112 string getOBSVR() { return OBSVR ; } ;
113 string getLOSTM() { return LOSTM ; } ;
114 string getLOETM() { return LOETM ; } ;
115 int getARYNM() { return ARYNM ; } ;
116 int getNSCAN() { return NSCAN ; } ;
117 string getTITLE() { return TITLE ; } ;
118 string getOBJ() { return OBJ ; } ;
119 string getEPOCH() { return EPOCH ; } ;
120 double getRA0() { return RA0 ; } ;
121 double getDEC0() { return DEC0 ; } ;
122 double getGLNG0() { return GLNG0 ; } ;
123 double getGLAT0() { return GLAT0 ; } ;
124 int getNCALB() { return NCALB ; } ;
125 int getSCNCD() { return SCNCD ; } ;
126 string getSCMOD() { return SCMOD ; } ;
127 double getURVEL() { return URVEL ; } ;
128 string getVREF() { return VREF ; } ;
129 string getVDEF() { return VDEF ; } ;
130 string getSWMOD() { return SWMOD ; } ;
131 double getFRQSW() { return FRQSW ; } ;
132 double getDBEAM() { return DBEAM ; } ;
133 double getMLTOF() { return MLTOF ; } ;
134 double getCMTQ() { return CMTQ ; } ;
135 double getCMTE() { return CMTE ; } ;
136 double getCMTSOM() { return CMTSOM ; } ;
137 double getCMTNODE() { return CMTNODE ; } ;
138 double getCMTI() { return CMTI ; } ;
139 string getCMTTM() { return CMTTM ; } ;
140 double getSBDX() { return SBDX ; } ;
141 double getSBDY() { return SBDY ; } ;
142 double getSBDZ1() { return SBDZ1 ; } ;
143 double getSBDZ2() { return SBDZ2 ; } ;
144 double getDAZP() { return DAZP ; } ;
145 double getDELP() { return DELP ; } ;
146 int getCHBIND() { return CHBIND ; } ;
147 int getNUMCH() { return NUMCH ; } ;
148 int getCHMIN() { return CHMIN ; } ;
149 int getCHMAX() { return CHMAX ; } ;
150 double getALCTM() { return ALCTM ; } ;
151 double getIPTIM() { return IPTIM ; } ;
152 double getPA() { return PA ; } ;
153 int getSCNLEN() { return SCNLEN ; } ;
154 int getSBIND() { return SBIND ; } ;
155 int getIBIT() { return IBIT ; } ;
156 string getSITE() { return SITE ; } ;
157 vector<string> getRX() { return RX ; } ;
158 vector<double> getHPBW() { return HPBW ; } ;
159 vector<double> getEFFA() { return EFFA ; } ;
160 vector<double> getEFFB() { return EFFB ; } ;
161 vector<double> getEFFL() { return EFFL ; } ;
162 vector<double> getEFSS() { return EFSS ; } ;
163 vector<double> getGAIN() { return GAIN ; } ;
164 vector<string> getHORN() { return HORN ; } ;
165 vector<string> getPOLTP() { return POLTP ; } ;
166 vector<double> getPOLDR() { return POLDR ; } ;
167 vector<double> getPOLAN() { return POLAN ; } ;
168 vector<double> getDFRQ() { return DFRQ ; } ;
169 vector<string> getSIDBD() { return SIDBD ; } ;
170 vector<int> getREFN() { return REFN ; } ;
171 vector<int> getIPINT() { return IPINT ; } ;
172 vector<int> getMULTN() { return MULTN ; } ;
173 vector<double> getMLTSCF() { return MLTSCF ; } ;
174 vector<string> getLAGWIND() { return LAGWIND ; } ;
175 vector<double> getBEBW() { return BEBW ; } ;
176 vector<double> getBERES() { return BERES ; } ;
177 vector<double> getCHWID() { return CHWID ; } ;
178 vector<int> getARRY() { return ARRY ; } ;
179 vector<int> getNFCAL() { return NFCAL ; } ;
180 vector<double> getF0CAL() { return F0CAL ; } ;
181 vector< vector<double> > getFQCAL() { return FQCAL ; } ;
182 vector< vector<double> > getCHCAL() { return CHCAL ; } ;
183 vector< vector<double> > getCWCAL() { return CWCAL ; } ;
184 string getCDMY1() { return CDMY1 ; } ;
185 vector<double> getDSBFC() { return DSBFC ;} ;
186 int getDataSize() { return datasize_ ; } ;
187 int getRowNum() { return rowNum_ ; } ;
188
189 // get various parameters
190 NRODataRecord *getRecord( int i ) ;
191 virtual vector< vector<double> > getSpectrum() ;
192 virtual vector<double> getSpectrum( int i ) ;
193 virtual int getIndex( int irow ) ;
194 virtual int getPolarizationNum() ;
195 virtual vector<double> getStartIntTime() ;
196 virtual double getStartIntTime( int i ) ;
[2156]197 virtual double getScanTime( int i ) ;
[1757]198 virtual double getMJD( char *time ) ;
199 virtual vector<bool> getIFs() ;
200 virtual vector<double> getFrequencies( int i ) ;
201 virtual uInt getArrayId( string type ) ;
202
203 protected:
204 // fill header information
205 virtual int fillHeader( int sameEndian ) = 0 ;
206
207 // Endian conversion for int variable
208 void convertEndian( int &value ) ;
209
210 // Endian convertion for float variable
211 void convertEndian( float &value ) ;
212
213 // Endian conversion for double variable
214 void convertEndian( double &value ) ;
215
216 // Endian conversion for NRODataRecord
217 void convertEndian( NRODataRecord *r ) ;
218
219 // Read char data
220 int readHeader( char *v, int size ) ;
221
222 // Read int data
223 int readHeader( int &v, int b ) ;
224
225 // Read float data
226 int readHeader( float &v, int b ) ;
227
228 // Read double data
229 int readHeader( double &v, int b ) ;
230
231 // Release DataRecord
232 void releaseRecord() ;
233
234 // show primary information
235 void show() ;
236
[1868]237 // convert frequency frame
238 virtual double toLSR( double v, double t, double x, double y ) ;
239
[1757]240 // Type of file record
241 string LOFIL ;
242
243 // Version
244 string VER ;
245
246 // Group name
247 string GROUP ;
248
249 // Project name
250 string PROJ ;
251
252 // Name of observation scheduling file
253 string SCHED ;
254
255 // Name of observer
256 string OBSVR ;
257
258 // Observation start time with format of "YYYYMMDDHHMMSS" (UTC)
259 string LOSTM ;
260
261 // observation end time with format of "YYYYMMDDHHMMSS" (UTC)
262 string LOETM ;
263
264 // Number of arrays (beams and IFs)
265 int ARYNM ;
266
267 // Number of scans
268 int NSCAN ;
269
270 // Title of observation
271 string TITLE ;
272
273 // Name of target object
274 string OBJ ;
275
276 // Equinox (B1950 or J2000)
277 string EPOCH ;
278
279 // Right ascension [rad]
280 double RA0 ;
281
282 // Declination [rad]
283 double DEC0 ;
284
285 // Galactic longitude [rad]
286 double GLNG0 ;
287
288 // Galactic latitude [rad]
289 double GLAT0 ;
290
291 // Calibration interval
292 int NCALB ;
293
294 // Scan coordinate (0: RADEC 1: LB 2: AZEL)
295 int SCNCD ;
296
297 // Scan sequence pattern
298 string SCMOD ;
299
300 // User-defined recessional velocity [m/s]
301 double URVEL ;
302
303 // Reference frame for recessional velocity (LSR or HEL or GAL)
304 string VREF ;
305
306 // Definition of recessional velocity (RAD or OPT)
307 string VDEF ;
308
309 // Switching mode (POS or BEAM or FREQ)
310 string SWMOD ;
311
312 // Switching frequency [Hz]
313 double FRQSW ;
314
315 // Off-beam angle of beam switching [rad]
316 double DBEAM ;
317
318 // Initial inclination angle of multi-beam array
319 double MLTOF ;
320
321 // Comet: Perihelion distance
322 double CMTQ ;
323
324 // Comet: Eccentricity
325 double CMTE ;
326
327 // Comet: Argument of perihelion
328 double CMTSOM ;
329
330 // Comet: Longitude of the ascending node
331 double CMTNODE ;
332
333 // Comet: Orbital inclination angle
334 double CMTI ;
335
336 // Comet: Time of the perihelion passage
337 string CMTTM ;
338
339 // Correction for position of subreflector DX [mm]
340 double SBDX ;
341
342 // Correction for position of subreflector DY [mm]
343 double SBDY ;
344
345 // Correction for position of subreflector DZ1 [mm]
346 double SBDZ1 ;
347
348 // Correction for position of subreflector DZ2 [mm]
349 double SBDZ2 ;
350
351 // Correction for pointing on azimuth [rad]
352 double DAZP ;
353
354 // Correction for pointing on elevation [rad]
355 double DELP ;
356
357 // Number of channel binding
358 int CHBIND ;
359
360 // Number of channel after binding
361 int NUMCH ;
362
363 // Channel range (minimum)
364 int CHMIN ;
365
366 // Channel range (maximum)
367 int CHMAX ;
368
369 // ALC time constant
370 double ALCTM ;
371
372 // Interval to get data from spectrometer
373 double IPTIM ;
374
375 // Position angle of the map
376 double PA ;
377
378 // Length of scan record [bytes]
379 int SCNLEN ;
380
381 // Range of space binding
382 int SBIND ;
383
384 // Quantization bit number (fixed to 12)
385 int IBIT ;
386
387 // Site (antenna) name (45m or ASTE)
388 string SITE ;
389
390 // Dummy data
391 string CDMY1 ;
392
393 // Type of detector frontend
394 vector<string> RX ;
395
396 // HPBW [rad]
397 vector<double> HPBW ;
398
399 // Aperture efficiencies
400 vector<double> EFFA ;
401
402 // Beam efficiencies
403 vector<double> EFFB ;
404
405 // Antenna efficiencies
406 vector<double> EFFL ;
407
408 // FSS efficiencies
409 vector<double> EFSS ;
410
411 // Antenna gain
412 vector<double> GAIN ;
413
414 // Type of polarization at feed horn (R or L or H or V)
415 vector<string> HORN ;
416
417 // Type of polarization (CIRC or LINR)
418 vector<string> POLTP ;
419
420 // Rotation direction of circular polarization
421 vector<double> POLDR ;
422
423 // Polarization angle of linear polarization
424 vector<double> POLAN ;
425
426 // Switching frequency of frequcency switching [Hz]
427 vector<double> DFRQ ;
428
429 // Type of sideband (LSB or USB or DSB)
430 vector<string> SIDBD ;
431
432 // Identifier of reference synthesizer
433 vector<int> REFN ;
434
435 // Temperature of calibrator
436 vector<int> IPINT ;
437
438 // Beam id of the multi-beam detector
439 vector<int> MULTN ;
440
441 // Scaling factor of the multi-beam detector
442 vector<double> MLTSCF ;
443
444 // Type of LAG window (NONE or HANN or HAMM or BLCK)
445 vector<string> LAGWIND ;
446
447 // Bandwidth at backend
448 vector<double> BEBW ;
449
450 // Spectral resolution at backend
451 vector<double> BERES ;
452
453 // Channel width at backend
454 vector<double> CHWID ;
455
456 // Array usage (1: used 0: not used)
457 vector<int> ARRY ;
458
459 // Frequency calibration: Number of measurement (max 10)
460 vector<int> NFCAL ;
461
462 // Frequency calibration: Central frequency [Hz]
463 vector<double> F0CAL ;
464
465 // Frequency calibration: Measured central frequency [Hz]
466 vector< vector<double> > FQCAL ;
467
468 // Frequency calibration: Measured channel number
469 vector< vector<double> > CHCAL ;
470
471 // Frequency calibration: Measured channel width [Hz]
472 vector< vector<double> > CWCAL ;
473
474 // DSB scaling factor
475 vector<double> DSBFC ;
476
477 // number of scan
478 int scanNum_ ;
479
480 // number of row
481 int rowNum_ ;
482
483 // length of scan (byte)
484 int scanLen_ ;
485
486 // length of spectral data (byte)
487 int dataLen_ ;
488
489 // Data size of the header [bytes]
490 int datasize_ ;
491
492 // maximum channel number
493 int chmax_ ;
494
495 // Current data id
496 int dataid_ ;
497
498 // Data record
499 NRODataRecord *record_ ;
500
501 // input filename
502 string filename_ ;
503
504 // file pointer
505 FILE *fp_ ;
506
507 // OS endian
508 int same_ ;
509
510 // Logger
511 //LogIO os ;
[1868]512
513 // reference frequency for each array
514 vector<double> refFreq_ ;
[2198]515
516 // record to store REFPIX, REFVAL, INCREMENT pair for each array
517 Record frec_ ;
[1757]518} ;
519
520
521#endif /* NRO_HEADER_H */
Note: See TracBrowser for help on using the repository browser.