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

Last change on this file since 2194 was 2156, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: Yes CAS-2819

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs:

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on TIME value: changed from start time to mid point of integration.


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