source: branches/newfiller/external-alma/atnf/PKSIO/NRODataset.h@ 2735

Last change on this file since 2735 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


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