| 1 | //#---------------------------------------------------------------------------
|
|---|
| 2 | //# NROFITSDataset.h: Class for NRO 45m FITS 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_FITS_DATASET_H
|
|---|
| 34 | #define NRO_FITS_DATASET_H
|
|---|
| 35 |
|
|---|
| 36 | #define NRO_FITS_ARYMAX 75
|
|---|
| 37 |
|
|---|
| 38 | #include <atnf/PKSIO/NRODataset.h>
|
|---|
| 39 |
|
|---|
| 40 | #include <string>
|
|---|
| 41 | #include <map>
|
|---|
| 42 |
|
|---|
| 43 | using namespace std ;
|
|---|
| 44 |
|
|---|
| 45 | // <summary>
|
|---|
| 46 | // Accessor class for NRO 45m FITS data.
|
|---|
| 47 | // </summary>
|
|---|
| 48 | //
|
|---|
| 49 | // <prerequisite>
|
|---|
| 50 | // <li> <linkto class=NRO45FITSReader>NRO45FITSReader</linkto>
|
|---|
| 51 | // <li> <linkto class=NRODataset>NRODataset</linkto>
|
|---|
| 52 | // </prerequisite>
|
|---|
| 53 | //
|
|---|
| 54 | // <reviewed reviewer="" date="" tests="" demos="">
|
|---|
| 55 | // </reviewed>
|
|---|
| 56 | //
|
|---|
| 57 | // <etymology>
|
|---|
| 58 | // This class actually accesses data from NRO telescopes. This is specialized class
|
|---|
| 59 | // for NRO 45m telescope with non-OTF observing mode. In contrast to other concrete classes,
|
|---|
| 60 | // both fillHeader and fillRecord methods are implemented here.
|
|---|
| 61 | // This is because that the output of non-OTF observing mode is in FITS format and is
|
|---|
| 62 | // quite different format from that of OTF observing mode.
|
|---|
| 63 | // </etymology>
|
|---|
| 64 | //
|
|---|
| 65 | // <note>
|
|---|
| 66 | // Although the input data is FITS format, the class does not depend on cfitsio library.
|
|---|
| 67 | // </note>
|
|---|
| 68 | //
|
|---|
| 69 | // <synopsis>
|
|---|
| 70 | // Accessor class for NRO 45m FITS data.
|
|---|
| 71 | // </synopsis>
|
|---|
| 72 | //
|
|---|
| 73 |
|
|---|
| 74 | class NROFITSDataset : public NRODataset
|
|---|
| 75 | {
|
|---|
| 76 | public:
|
|---|
| 77 | // constructor
|
|---|
| 78 | NROFITSDataset( string name ) ;
|
|---|
| 79 |
|
|---|
| 80 | // destructor
|
|---|
| 81 | virtual ~NROFITSDataset() ;
|
|---|
| 82 |
|
|---|
| 83 | // data initialization
|
|---|
| 84 | virtual void initialize() ;
|
|---|
| 85 |
|
|---|
| 86 | // fill data record
|
|---|
| 87 | virtual int fillRecord( int i ) ;
|
|---|
| 88 |
|
|---|
| 89 | // get various parameters
|
|---|
| 90 | virtual vector< vector<double> > getSpectrum() ;
|
|---|
| 91 | virtual vector<double> getSpectrum( int i ) ;
|
|---|
| 92 | virtual int getIndex( int irow ) ;
|
|---|
| 93 | virtual int getPolarizationNum() ;
|
|---|
| 94 | virtual uInt getArrayId( string type ) ;
|
|---|
| 95 | virtual double getStartIntTime( int i ) ;
|
|---|
| 96 | virtual double getScanTime( int i ) ;
|
|---|
| 97 | virtual uInt getPolNo( int irow ) ;
|
|---|
| 98 |
|
|---|
| 99 | protected:
|
|---|
| 100 | // stracture representing property of fields
|
|---|
| 101 | struct FieldProperty {
|
|---|
| 102 | //string name; // field name
|
|---|
| 103 | int size; // data size [byte]
|
|---|
| 104 | //string unit; // unit of the field
|
|---|
| 105 | long offset; // offset from the head of scan record [byte]
|
|---|
| 106 | };
|
|---|
| 107 |
|
|---|
| 108 | // fill header information
|
|---|
| 109 | int fillHeader( int sameEndian ) ;
|
|---|
| 110 |
|
|---|
| 111 | // Read char data
|
|---|
| 112 | int readHeader( string &v, const char *name ) ;
|
|---|
| 113 | int readTable( char *v, const char *name, int clen, int idx=0 ) ;
|
|---|
| 114 | int readTable( vector<char *> &v, const char *name, int idx=0 ) ;
|
|---|
| 115 | int readColumn( vector<string> &v, const char *name, int idx=0 ) ;
|
|---|
| 116 |
|
|---|
| 117 | // Read int data
|
|---|
| 118 | int readHeader( int &v, const char *name) ;
|
|---|
| 119 | int readTable( int &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 120 | int readTable( vector<int> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 121 | int readColumn( vector<int> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 122 |
|
|---|
| 123 | // Read float data
|
|---|
| 124 | int readHeader( float &v, const char *name) ;
|
|---|
| 125 | int readTable( float &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 126 | int readTable( vector<float> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 127 | int readColumn( vector<float> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 128 |
|
|---|
| 129 | // Read double data
|
|---|
| 130 | int readHeader( double &v, const char *name) ;
|
|---|
| 131 | int readTable( double &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 132 | int readTable( vector<double> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 133 | int readColumn( vector<double> &v, const char *name, int b, int idx=0 ) ;
|
|---|
| 134 |
|
|---|
| 135 | // read ARRY
|
|---|
| 136 | int readARRY() ;
|
|---|
| 137 |
|
|---|
| 138 | // Convert RA character representation to radian
|
|---|
| 139 | double radRA( string ra ) ;
|
|---|
| 140 |
|
|---|
| 141 | // Convert DEC character representation to radian
|
|---|
| 142 | double radDEC( string dec ) ;
|
|---|
| 143 |
|
|---|
| 144 | // get field parameters for scan header
|
|---|
| 145 | void getField() ;
|
|---|
| 146 |
|
|---|
| 147 | // fill array type
|
|---|
| 148 | void fillARYTP() ;
|
|---|
| 149 |
|
|---|
| 150 | // find data for each ARYTP
|
|---|
| 151 | void findData() ;
|
|---|
| 152 |
|
|---|
| 153 | // get offset bytes for attributes
|
|---|
| 154 | long getOffset( const char *name ) ;
|
|---|
| 155 |
|
|---|
| 156 | // move pointer to target position
|
|---|
| 157 | int movePointer( const char *name, int idx=0 ) ;
|
|---|
| 158 |
|
|---|
| 159 | // number of column for scan header
|
|---|
| 160 | int numField_ ;
|
|---|
| 161 |
|
|---|
| 162 | // number of HDU
|
|---|
| 163 | int numHdu_ ;
|
|---|
| 164 |
|
|---|
| 165 | // array type
|
|---|
| 166 | vector<string> ARYTP ;
|
|---|
| 167 |
|
|---|
| 168 | // reference index
|
|---|
| 169 | vector<int> arrayid_ ;
|
|---|
| 170 |
|
|---|
| 171 | // field properties
|
|---|
| 172 | // Key = field name
|
|---|
| 173 | // Value = field properties
|
|---|
| 174 | map<string, FieldProperty> properties_ ;
|
|---|
| 175 |
|
|---|
| 176 | // spectral data
|
|---|
| 177 | vector<int> JDATA ;
|
|---|
| 178 | } ;
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | #endif /* NRO_FITS_DATASET_H */
|
|---|