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

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

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): atnf

Description: Describe your changes here...

Sync with code/atnf/implement/PKSIO


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 ) ;
196 virtual double getMJD( char *time ) ;
197 virtual vector<bool> getIFs() ;
198 virtual vector<double> getFrequencies( int i ) ;
199 virtual uInt getArrayId( string type ) ;
200
201 protected:
202 // fill header information
203 virtual int fillHeader( int sameEndian ) = 0 ;
204
205 // Endian conversion for int variable
206 void convertEndian( int &value ) ;
207
208 // Endian convertion for float variable
209 void convertEndian( float &value ) ;
210
211 // Endian conversion for double variable
212 void convertEndian( double &value ) ;
213
214 // Endian conversion for NRODataRecord
215 void convertEndian( NRODataRecord *r ) ;
216
217 // Read char data
218 int readHeader( char *v, int size ) ;
219
220 // Read int data
221 int readHeader( int &v, int b ) ;
222
223 // Read float data
224 int readHeader( float &v, int b ) ;
225
226 // Read double data
227 int readHeader( double &v, int b ) ;
228
229 // Release DataRecord
230 void releaseRecord() ;
231
232 // show primary information
233 void show() ;
234
[1868]235 // convert frequency frame
236 virtual double toLSR( double v, double t, double x, double y ) ;
237
[1757]238 // Type of file record
239 string LOFIL ;
240
241 // Version
242 string VER ;
243
244 // Group name
245 string GROUP ;
246
247 // Project name
248 string PROJ ;
249
250 // Name of observation scheduling file
251 string SCHED ;
252
253 // Name of observer
254 string OBSVR ;
255
256 // Observation start time with format of "YYYYMMDDHHMMSS" (UTC)
257 string LOSTM ;
258
259 // observation end time with format of "YYYYMMDDHHMMSS" (UTC)
260 string LOETM ;
261
262 // Number of arrays (beams and IFs)
263 int ARYNM ;
264
265 // Number of scans
266 int NSCAN ;
267
268 // Title of observation
269 string TITLE ;
270
271 // Name of target object
272 string OBJ ;
273
274 // Equinox (B1950 or J2000)
275 string EPOCH ;
276
277 // Right ascension [rad]
278 double RA0 ;
279
280 // Declination [rad]
281 double DEC0 ;
282
283 // Galactic longitude [rad]
284 double GLNG0 ;
285
286 // Galactic latitude [rad]
287 double GLAT0 ;
288
289 // Calibration interval
290 int NCALB ;
291
292 // Scan coordinate (0: RADEC 1: LB 2: AZEL)
293 int SCNCD ;
294
295 // Scan sequence pattern
296 string SCMOD ;
297
298 // User-defined recessional velocity [m/s]
299 double URVEL ;
300
301 // Reference frame for recessional velocity (LSR or HEL or GAL)
302 string VREF ;
303
304 // Definition of recessional velocity (RAD or OPT)
305 string VDEF ;
306
307 // Switching mode (POS or BEAM or FREQ)
308 string SWMOD ;
309
310 // Switching frequency [Hz]
311 double FRQSW ;
312
313 // Off-beam angle of beam switching [rad]
314 double DBEAM ;
315
316 // Initial inclination angle of multi-beam array
317 double MLTOF ;
318
319 // Comet: Perihelion distance
320 double CMTQ ;
321
322 // Comet: Eccentricity
323 double CMTE ;
324
325 // Comet: Argument of perihelion
326 double CMTSOM ;
327
328 // Comet: Longitude of the ascending node
329 double CMTNODE ;
330
331 // Comet: Orbital inclination angle
332 double CMTI ;
333
334 // Comet: Time of the perihelion passage
335 string CMTTM ;
336
337 // Correction for position of subreflector DX [mm]
338 double SBDX ;
339
340 // Correction for position of subreflector DY [mm]
341 double SBDY ;
342
343 // Correction for position of subreflector DZ1 [mm]
344 double SBDZ1 ;
345
346 // Correction for position of subreflector DZ2 [mm]
347 double SBDZ2 ;
348
349 // Correction for pointing on azimuth [rad]
350 double DAZP ;
351
352 // Correction for pointing on elevation [rad]
353 double DELP ;
354
355 // Number of channel binding
356 int CHBIND ;
357
358 // Number of channel after binding
359 int NUMCH ;
360
361 // Channel range (minimum)
362 int CHMIN ;
363
364 // Channel range (maximum)
365 int CHMAX ;
366
367 // ALC time constant
368 double ALCTM ;
369
370 // Interval to get data from spectrometer
371 double IPTIM ;
372
373 // Position angle of the map
374 double PA ;
375
376 // Length of scan record [bytes]
377 int SCNLEN ;
378
379 // Range of space binding
380 int SBIND ;
381
382 // Quantization bit number (fixed to 12)
383 int IBIT ;
384
385 // Site (antenna) name (45m or ASTE)
386 string SITE ;
387
388 // Dummy data
389 string CDMY1 ;
390
391 // Type of detector frontend
392 vector<string> RX ;
393
394 // HPBW [rad]
395 vector<double> HPBW ;
396
397 // Aperture efficiencies
398 vector<double> EFFA ;
399
400 // Beam efficiencies
401 vector<double> EFFB ;
402
403 // Antenna efficiencies
404 vector<double> EFFL ;
405
406 // FSS efficiencies
407 vector<double> EFSS ;
408
409 // Antenna gain
410 vector<double> GAIN ;
411
412 // Type of polarization at feed horn (R or L or H or V)
413 vector<string> HORN ;
414
415 // Type of polarization (CIRC or LINR)
416 vector<string> POLTP ;
417
418 // Rotation direction of circular polarization
419 vector<double> POLDR ;
420
421 // Polarization angle of linear polarization
422 vector<double> POLAN ;
423
424 // Switching frequency of frequcency switching [Hz]
425 vector<double> DFRQ ;
426
427 // Type of sideband (LSB or USB or DSB)
428 vector<string> SIDBD ;
429
430 // Identifier of reference synthesizer
431 vector<int> REFN ;
432
433 // Temperature of calibrator
434 vector<int> IPINT ;
435
436 // Beam id of the multi-beam detector
437 vector<int> MULTN ;
438
439 // Scaling factor of the multi-beam detector
440 vector<double> MLTSCF ;
441
442 // Type of LAG window (NONE or HANN or HAMM or BLCK)
443 vector<string> LAGWIND ;
444
445 // Bandwidth at backend
446 vector<double> BEBW ;
447
448 // Spectral resolution at backend
449 vector<double> BERES ;
450
451 // Channel width at backend
452 vector<double> CHWID ;
453
454 // Array usage (1: used 0: not used)
455 vector<int> ARRY ;
456
457 // Frequency calibration: Number of measurement (max 10)
458 vector<int> NFCAL ;
459
460 // Frequency calibration: Central frequency [Hz]
461 vector<double> F0CAL ;
462
463 // Frequency calibration: Measured central frequency [Hz]
464 vector< vector<double> > FQCAL ;
465
466 // Frequency calibration: Measured channel number
467 vector< vector<double> > CHCAL ;
468
469 // Frequency calibration: Measured channel width [Hz]
470 vector< vector<double> > CWCAL ;
471
472 // DSB scaling factor
473 vector<double> DSBFC ;
474
475 // number of scan
476 int scanNum_ ;
477
478 // number of row
479 int rowNum_ ;
480
481 // length of scan (byte)
482 int scanLen_ ;
483
484 // length of spectral data (byte)
485 int dataLen_ ;
486
487 // Data size of the header [bytes]
488 int datasize_ ;
489
490 // maximum channel number
491 int chmax_ ;
492
493 // Current data id
494 int dataid_ ;
495
496 // Data record
497 NRODataRecord *record_ ;
498
499 // input filename
500 string filename_ ;
501
502 // file pointer
503 FILE *fp_ ;
504
505 // OS endian
506 int endian_ ;
507 int same_ ;
508
509 // Logger
510 //LogIO os ;
[1868]511
512 // reference frequency for each array
513 vector<double> refFreq_ ;
[1757]514} ;
515
516
517#endif /* NRO_HEADER_H */
Note: See TracBrowser for help on using the repository browser.