//#--------------------------------------------------------------------------- //# NRODataset.h: Base class for NRO dataset. //#--------------------------------------------------------------------------- //# Copyright (C) 2000-2006 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# $Id$ //#--------------------------------------------------------------------------- //# Original: 2009/02/27, Takeshi Nakazato, NAOJ //#--------------------------------------------------------------------------- #ifndef NRO_DATASET_H #define NRO_DATASET_H #include #include #include #include //#include #include #include #include #define SCAN_HEADER_SIZE 424 using namespace std ; // // Base class for NRO accessor classes. // // // //
  • NROReader //
  • NRODataRecord // // // // // // // This class is a base class for classes that actually access data from NRO telescopes. // Concrete classes are defiened for each data type (OTF format or NRO FITS) and/or // telescopes (45m or ASTE). // The class have two filler method: fillHeader and fillRecord. The former reads header // information from the data. Since header data depends on the telescope and its configuration, // it is an abstract in this class and is defined in each concrete class. // On the other hand, the later reads each scan record (set of meta data // and spectral data). The method uses NRODataRecord // to access scan record. It is implemented here since contents of scan record is // quite similar for several types of data. // // // // Abstract class that is designed as a base class for all accessor classes. // // class NRODataset { public: // Constructor NRODataset( string name ) ; // Destructor virtual ~NRODataset() ; // Data initialization virtual void initialize() ; // open file virtual int open() ; // close file virtual void close() ; // Fill data header from file virtual int fillHeader() = 0 ; // Fill data record virtual int fillRecord( int i ) ; // simple getter string getLOFIL() { return LOFIL ; } ; string getVER() { return VER ; } ; string getGROUP() { return GROUP ; } ; string getPROJ() { return PROJ ; } ; string getSCHED() { return SCHED ; } ; string getOBSVR() { return OBSVR ; } ; string getLOSTM() { return LOSTM ; } ; string getLOETM() { return LOETM ; } ; int getARYNM() { return ARYNM ; } ; int getNSCAN() { return NSCAN ; } ; string getTITLE() { return TITLE ; } ; string getOBJ() { return OBJ ; } ; string getEPOCH() { return EPOCH ; } ; double getRA0() { return RA0 ; } ; double getDEC0() { return DEC0 ; } ; double getGLNG0() { return GLNG0 ; } ; double getGLAT0() { return GLAT0 ; } ; int getNCALB() { return NCALB ; } ; int getSCNCD() { return SCNCD ; } ; string getSCMOD() { return SCMOD ; } ; double getURVEL() { return URVEL ; } ; string getVREF() { return VREF ; } ; string getVDEF() { return VDEF ; } ; string getSWMOD() { return SWMOD ; } ; double getFRQSW() { return FRQSW ; } ; double getDBEAM() { return DBEAM ; } ; double getMLTOF() { return MLTOF ; } ; double getCMTQ() { return CMTQ ; } ; double getCMTE() { return CMTE ; } ; double getCMTSOM() { return CMTSOM ; } ; double getCMTNODE() { return CMTNODE ; } ; double getCMTI() { return CMTI ; } ; string getCMTTM() { return CMTTM ; } ; double getSBDX() { return SBDX ; } ; double getSBDY() { return SBDY ; } ; double getSBDZ1() { return SBDZ1 ; } ; double getSBDZ2() { return SBDZ2 ; } ; double getDAZP() { return DAZP ; } ; double getDELP() { return DELP ; } ; int getCHBIND() { return CHBIND ; } ; int getNUMCH() { return NUMCH ; } ; int getCHMIN() { return CHMIN ; } ; int getCHMAX() { return CHMAX ; } ; double getALCTM() { return ALCTM ; } ; double getIPTIM() { return IPTIM ; } ; double getPA() { return PA ; } ; int getSCNLEN() { return SCNLEN ; } ; int getSBIND() { return SBIND ; } ; int getIBIT() { return IBIT ; } ; string getSITE() { return SITE ; } ; vector getRX() { return RX ; } ; vector getHPBW() { return HPBW ; } ; vector getEFFA() { return EFFA ; } ; vector getEFFB() { return EFFB ; } ; vector getEFFL() { return EFFL ; } ; vector getEFSS() { return EFSS ; } ; vector getGAIN() { return GAIN ; } ; vector getHORN() { return HORN ; } ; vector getPOLTP() { return POLTP ; } ; vector getPOLDR() { return POLDR ; } ; vector getPOLAN() { return POLAN ; } ; vector getDFRQ() { return DFRQ ; } ; vector getSIDBD() { return SIDBD ; } ; vector getREFN() { return REFN ; } ; vector getIPINT() { return IPINT ; } ; vector getMULTN() { return MULTN ; } ; vector getMLTSCF() { return MLTSCF ; } ; vector getLAGWIND() { return LAGWIND ; } ; vector getBEBW() { return BEBW ; } ; vector getBERES() { return BERES ; } ; vector getCHWID() { return CHWID ; } ; vector getARRY() { return ARRY ; } ; vector getNFCAL() { return NFCAL ; } ; vector getF0CAL() { return F0CAL ; } ; vector< vector > getFQCAL() { return FQCAL ; } ; vector< vector > getCHCAL() { return CHCAL ; } ; vector< vector > getCWCAL() { return CWCAL ; } ; string getCDMY1() { return CDMY1 ; } ; vector getDSBFC() { return DSBFC ;} ; int getDataSize() { return datasize_ ; } ; int getRowNum() { return rowNum_ ; } ; // get various parameters NRODataRecord *getRecord( int i ) ; virtual vector< vector > getSpectrum() ; virtual vector getSpectrum( int i ) ; virtual int getIndex( int irow ) ; virtual int getPolarizationNum() ; virtual vector getStartIntTime() ; virtual double getStartIntTime( int i ) ; virtual double getMJD( char *time ) ; virtual vector getIFs() ; virtual vector getFrequencies( int i ) ; virtual uInt getArrayId( string type ) ; protected: // fill header information virtual int fillHeader( int sameEndian ) = 0 ; // Endian conversion for int variable void convertEndian( int &value ) ; // Endian convertion for float variable void convertEndian( float &value ) ; // Endian conversion for double variable void convertEndian( double &value ) ; // Endian conversion for NRODataRecord void convertEndian( NRODataRecord *r ) ; // Read char data int readHeader( char *v, int size ) ; // Read int data int readHeader( int &v, int b ) ; // Read float data int readHeader( float &v, int b ) ; // Read double data int readHeader( double &v, int b ) ; // Release DataRecord void releaseRecord() ; // show primary information void show() ; // Type of file record string LOFIL ; // Version string VER ; // Group name string GROUP ; // Project name string PROJ ; // Name of observation scheduling file string SCHED ; // Name of observer string OBSVR ; // Observation start time with format of "YYYYMMDDHHMMSS" (UTC) string LOSTM ; // observation end time with format of "YYYYMMDDHHMMSS" (UTC) string LOETM ; // Number of arrays (beams and IFs) int ARYNM ; // Number of scans int NSCAN ; // Title of observation string TITLE ; // Name of target object string OBJ ; // Equinox (B1950 or J2000) string EPOCH ; // Right ascension [rad] double RA0 ; // Declination [rad] double DEC0 ; // Galactic longitude [rad] double GLNG0 ; // Galactic latitude [rad] double GLAT0 ; // Calibration interval int NCALB ; // Scan coordinate (0: RADEC 1: LB 2: AZEL) int SCNCD ; // Scan sequence pattern string SCMOD ; // User-defined recessional velocity [m/s] double URVEL ; // Reference frame for recessional velocity (LSR or HEL or GAL) string VREF ; // Definition of recessional velocity (RAD or OPT) string VDEF ; // Switching mode (POS or BEAM or FREQ) string SWMOD ; // Switching frequency [Hz] double FRQSW ; // Off-beam angle of beam switching [rad] double DBEAM ; // Initial inclination angle of multi-beam array double MLTOF ; // Comet: Perihelion distance double CMTQ ; // Comet: Eccentricity double CMTE ; // Comet: Argument of perihelion double CMTSOM ; // Comet: Longitude of the ascending node double CMTNODE ; // Comet: Orbital inclination angle double CMTI ; // Comet: Time of the perihelion passage string CMTTM ; // Correction for position of subreflector DX [mm] double SBDX ; // Correction for position of subreflector DY [mm] double SBDY ; // Correction for position of subreflector DZ1 [mm] double SBDZ1 ; // Correction for position of subreflector DZ2 [mm] double SBDZ2 ; // Correction for pointing on azimuth [rad] double DAZP ; // Correction for pointing on elevation [rad] double DELP ; // Number of channel binding int CHBIND ; // Number of channel after binding int NUMCH ; // Channel range (minimum) int CHMIN ; // Channel range (maximum) int CHMAX ; // ALC time constant double ALCTM ; // Interval to get data from spectrometer double IPTIM ; // Position angle of the map double PA ; // Length of scan record [bytes] int SCNLEN ; // Range of space binding int SBIND ; // Quantization bit number (fixed to 12) int IBIT ; // Site (antenna) name (45m or ASTE) string SITE ; // Dummy data string CDMY1 ; // Type of detector frontend vector RX ; // HPBW [rad] vector HPBW ; // Aperture efficiencies vector EFFA ; // Beam efficiencies vector EFFB ; // Antenna efficiencies vector EFFL ; // FSS efficiencies vector EFSS ; // Antenna gain vector GAIN ; // Type of polarization at feed horn (R or L or H or V) vector HORN ; // Type of polarization (CIRC or LINR) vector POLTP ; // Rotation direction of circular polarization vector POLDR ; // Polarization angle of linear polarization vector POLAN ; // Switching frequency of frequcency switching [Hz] vector DFRQ ; // Type of sideband (LSB or USB or DSB) vector SIDBD ; // Identifier of reference synthesizer vector REFN ; // Temperature of calibrator vector IPINT ; // Beam id of the multi-beam detector vector MULTN ; // Scaling factor of the multi-beam detector vector MLTSCF ; // Type of LAG window (NONE or HANN or HAMM or BLCK) vector LAGWIND ; // Bandwidth at backend vector BEBW ; // Spectral resolution at backend vector BERES ; // Channel width at backend vector CHWID ; // Array usage (1: used 0: not used) vector ARRY ; // Frequency calibration: Number of measurement (max 10) vector NFCAL ; // Frequency calibration: Central frequency [Hz] vector F0CAL ; // Frequency calibration: Measured central frequency [Hz] vector< vector > FQCAL ; // Frequency calibration: Measured channel number vector< vector > CHCAL ; // Frequency calibration: Measured channel width [Hz] vector< vector > CWCAL ; // DSB scaling factor vector DSBFC ; // number of scan int scanNum_ ; // number of row int rowNum_ ; // length of scan (byte) int scanLen_ ; // length of spectral data (byte) int dataLen_ ; // Data size of the header [bytes] int datasize_ ; // maximum channel number int chmax_ ; // Current data id int dataid_ ; // Data record NRODataRecord *record_ ; // input filename string filename_ ; // file pointer FILE *fp_ ; // OS endian int endian_ ; int same_ ; // Logger //LogIO os ; } ; #endif /* NRO_HEADER_H */