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