[1757] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# NROReader.h: Base class to read NRO 45m and ASTE data. |
---|
| 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: 2008/10/30, Takeshi Nakazato, NAOJ |
---|
| 31 | //#--------------------------------------------------------------------------- |
---|
| 32 | |
---|
| 33 | #ifndef NRO_READER_H |
---|
| 34 | #define NRO_READER_H |
---|
| 35 | |
---|
| 36 | #include <string> |
---|
| 37 | #include <stdio.h> |
---|
| 38 | #include <vector> |
---|
| 39 | |
---|
| 40 | #include <casa/aips.h> |
---|
| 41 | #include <casa/Arrays/Vector.h> |
---|
| 42 | #include <casa/BasicSL/String.h> |
---|
| 43 | #include <measures/Measures/MPosition.h> |
---|
| 44 | #include <measures/Measures/MCPosition.h> |
---|
| 45 | #include <measures/Measures/MDirection.h> |
---|
| 46 | #include <measures/Measures/MCDirection.h> |
---|
| 47 | #include <measures/Measures/MeasConvert.h> |
---|
| 48 | #include <measures/Measures/MeasFrame.h> |
---|
| 49 | #include <casa/Logging/LogIO.h> |
---|
| 50 | |
---|
| 51 | //#include <fitsio.h> |
---|
| 52 | |
---|
| 53 | #include <casa/namespace.h> |
---|
| 54 | |
---|
| 55 | #include <atnf/PKSIO/NRODataset.h> |
---|
| 56 | #include <atnf/PKSIO/NRODataRecord.h> |
---|
| 57 | |
---|
| 58 | using namespace std ; |
---|
| 59 | |
---|
| 60 | // <summary> |
---|
| 61 | // Base class to read NRO 45m and ASTE data. |
---|
| 62 | // </summary> |
---|
| 63 | // <use visibility=global> |
---|
| 64 | // |
---|
| 65 | // <prerequisite> |
---|
| 66 | // <li> <linkto class=NRODataset>NRODataset</linkto> |
---|
| 67 | // </prerequisite> |
---|
| 68 | // |
---|
| 69 | // <reviewed reviewer="" date="" tests="" demos=""> |
---|
| 70 | // </reviewed> |
---|
| 71 | // |
---|
| 72 | // <etymology> |
---|
| 73 | // <linkto class=NROReader>NROReader</linkto> is a base class for all NRO reader classes. |
---|
| 74 | // Reader classes have <linkto class=NRODataset>NRODataset</linkto> object to access |
---|
| 75 | // actual data. These classes are a kind of interface for Scantable data filler. |
---|
| 76 | // </etymology> |
---|
| 77 | // |
---|
| 78 | // <synopsis> |
---|
| 79 | // Abstract class that is designed as a base class for NRO reader classes. |
---|
| 80 | // </synopsis> |
---|
| 81 | // |
---|
| 82 | |
---|
| 83 | // Open an appropriate NROreader for a NRO 45m and ASTE dataset. |
---|
| 84 | class NROReader *getNROReader( const String filename, |
---|
| 85 | String &datatype ); |
---|
| 86 | |
---|
| 87 | // As above, but search a list of directories for it. |
---|
| 88 | class NROReader *getNROReader( const String filename, |
---|
| 89 | const Vector<String> directories, |
---|
| 90 | int &iDir, |
---|
| 91 | String &datatype ) ; |
---|
| 92 | |
---|
| 93 | // |
---|
| 94 | // NROReader |
---|
| 95 | // |
---|
| 96 | class NROReader |
---|
| 97 | { |
---|
| 98 | public: |
---|
| 99 | // Constructor |
---|
| 100 | NROReader( string name ) ; |
---|
| 101 | |
---|
| 102 | // Destructor. |
---|
| 103 | virtual ~NROReader() ; |
---|
| 104 | |
---|
| 105 | // Read data header |
---|
| 106 | virtual Int read() = 0 ; |
---|
| 107 | |
---|
| 108 | // Get header information |
---|
| 109 | virtual int getHeaderInfo( Int &nchan, |
---|
| 110 | Int &npol, |
---|
| 111 | Int &nif, |
---|
| 112 | Int &nbeam, |
---|
| 113 | String &observer, |
---|
| 114 | String &project, |
---|
| 115 | String &obstype, |
---|
| 116 | String &antname, |
---|
| 117 | Vector<Double> &antpos, |
---|
| 118 | Float &equinox, |
---|
| 119 | String &freqref, |
---|
| 120 | Double &reffreq, |
---|
| 121 | Double &bw, |
---|
| 122 | Double &utc, |
---|
| 123 | String &fluxunit, |
---|
| 124 | String &epoch, |
---|
| 125 | String &poltype ) ; |
---|
| 126 | |
---|
| 127 | // Get scan information |
---|
| 128 | virtual int getScanInfo( int irow, |
---|
| 129 | uInt &scanno, |
---|
| 130 | uInt &cycleno, |
---|
[2201] | 131 | uInt &ifno, |
---|
[1757] | 132 | uInt &beamno, |
---|
| 133 | uInt &polno, |
---|
| 134 | vector<double> &freqs, |
---|
| 135 | Vector<Double> &restfreq, |
---|
| 136 | uInt &refbeamno, |
---|
| 137 | Double &scantime, |
---|
| 138 | Double &interval, |
---|
| 139 | String &srcname, |
---|
| 140 | String &fieldname, |
---|
[2289] | 141 | Vector<Float> &spectra, |
---|
| 142 | Vector<uChar> &flagtra, |
---|
| 143 | Vector<Float> &tsys, |
---|
| 144 | Vector<Double> &direction, |
---|
[1757] | 145 | Float &azimuth, |
---|
| 146 | Float &elevation, |
---|
| 147 | Float ¶ngle, |
---|
| 148 | Float &opacity, |
---|
| 149 | uInt &tcalid, |
---|
| 150 | Int &fitid, |
---|
| 151 | uInt &focusid, |
---|
| 152 | Float &temperature, |
---|
| 153 | Float &pressure, |
---|
| 154 | Float &humidity, |
---|
| 155 | Float &windvel, |
---|
| 156 | Float &winddir, |
---|
| 157 | Double &srcvel, |
---|
[2289] | 158 | Vector<Double> &propermotion, |
---|
[1757] | 159 | Vector<Double> &srcdir, |
---|
[2289] | 160 | Vector<Double> &scanrate ) ; |
---|
[1757] | 161 | |
---|
| 162 | // Get scan type |
---|
| 163 | virtual string getScanType( int i ) ; |
---|
| 164 | |
---|
| 165 | // Get dataset |
---|
| 166 | virtual NRODataset *getDataset() { return dataset_ ; } ; |
---|
| 167 | |
---|
| 168 | // Get number of rows |
---|
| 169 | virtual Int getRowNum() ; |
---|
| 170 | |
---|
| 171 | // Get IF settings |
---|
| 172 | virtual vector<Bool> getIFs() ; |
---|
| 173 | |
---|
[2154] | 174 | // Get Number of IFs |
---|
| 175 | virtual Int getNumIF() = 0 ; |
---|
| 176 | |
---|
[1757] | 177 | // Get Beam settings |
---|
| 178 | virtual vector<Bool> getBeams() ; |
---|
| 179 | |
---|
[2154] | 180 | // Get Number of Beams |
---|
| 181 | virtual Int getNumBeam() = 0 ; |
---|
| 182 | |
---|
[1757] | 183 | protected: |
---|
| 184 | // convert time in character representation to MJD representation |
---|
| 185 | virtual double getMJD( char *time ) ; |
---|
| 186 | virtual double getMJD( string strStartTime ) ; |
---|
| 187 | |
---|
| 188 | // Get spectrum |
---|
| 189 | virtual vector< vector<double> > getSpectrum() ; |
---|
| 190 | |
---|
| 191 | // Get number of polarization |
---|
| 192 | virtual Int getPolarizationNum() ; |
---|
| 193 | |
---|
| 194 | // Get MJD time |
---|
| 195 | virtual double getStartTime() ; |
---|
| 196 | virtual double getEndTime() ; |
---|
| 197 | virtual vector<double> getStartIntTime() ; |
---|
| 198 | //virtual double getStartIntTime( int i ) ; |
---|
| 199 | |
---|
| 200 | // Get Antenna Position in ITRF coordinate |
---|
| 201 | virtual vector<double> getAntennaPosition() = 0 ; |
---|
| 202 | |
---|
| 203 | // Get SRCDIRECTION in RADEC(J2000) |
---|
| 204 | virtual Vector<Double> getSourceDirection() ; |
---|
| 205 | |
---|
| 206 | // Get DIRECTION in RADEC(J2000) |
---|
| 207 | virtual Vector<Double> getDirection( int i ) ; |
---|
| 208 | |
---|
| 209 | // filename |
---|
| 210 | string filename_ ; |
---|
| 211 | |
---|
| 212 | // dataset |
---|
| 213 | NRODataset *dataset_ ; |
---|
| 214 | |
---|
| 215 | // Logger |
---|
| 216 | //LogIO os ; |
---|
| 217 | }; |
---|
| 218 | |
---|
| 219 | #endif /* NRO_READER_H */ |
---|