[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>
|
---|
[2761] | 44 | #include <measures/Measures/MEpoch.h>
|
---|
[1757] | 45 | #include <measures/Measures/MCPosition.h>
|
---|
| 46 | #include <measures/Measures/MDirection.h>
|
---|
| 47 | #include <measures/Measures/MCDirection.h>
|
---|
| 48 | #include <measures/Measures/MeasConvert.h>
|
---|
| 49 | #include <measures/Measures/MeasFrame.h>
|
---|
| 50 | #include <casa/Logging/LogIO.h>
|
---|
[2643] | 51 | #include <casa/Utilities/CountedPtr.h>
|
---|
[1757] | 52 |
|
---|
| 53 | //#include <fitsio.h>
|
---|
| 54 |
|
---|
| 55 | #include <casa/namespace.h>
|
---|
| 56 |
|
---|
| 57 | #include <atnf/PKSIO/NRODataset.h>
|
---|
| 58 | #include <atnf/PKSIO/NRODataRecord.h>
|
---|
| 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 |
|
---|
[2761] | 105 | // determine whether to import frequency as REST (frequency is same as
|
---|
| 106 | // NEWSTAR/NOSTAR) or as is (velocity is same as NEWSTAR/NOSTAR)
|
---|
| 107 | void setFreqRefFromVREF( bool fromVREF ) ;
|
---|
| 108 |
|
---|
[1757] | 109 | // Read data header
|
---|
| 110 | virtual Int read() = 0 ;
|
---|
| 111 |
|
---|
| 112 | // Get header information
|
---|
| 113 | virtual int getHeaderInfo( Int &nchan,
|
---|
| 114 | Int &npol,
|
---|
| 115 | Int &nif,
|
---|
| 116 | Int &nbeam,
|
---|
| 117 | String &observer,
|
---|
| 118 | String &project,
|
---|
| 119 | String &obstype,
|
---|
| 120 | String &antname,
|
---|
| 121 | Vector<Double> &antpos,
|
---|
| 122 | Float &equinox,
|
---|
| 123 | String &freqref,
|
---|
| 124 | Double &reffreq,
|
---|
| 125 | Double &bw,
|
---|
| 126 | Double &utc,
|
---|
| 127 | String &fluxunit,
|
---|
| 128 | String &epoch,
|
---|
| 129 | String &poltype ) ;
|
---|
| 130 |
|
---|
| 131 | // Get scan information
|
---|
| 132 | virtual int getScanInfo( int irow,
|
---|
| 133 | uInt &scanno,
|
---|
| 134 | uInt &cycleno,
|
---|
[2201] | 135 | uInt &ifno,
|
---|
[1757] | 136 | uInt &beamno,
|
---|
| 137 | uInt &polno,
|
---|
[2761] | 138 | std::vector<double> &freqs,
|
---|
[1757] | 139 | Vector<Double> &restfreq,
|
---|
| 140 | uInt &refbeamno,
|
---|
| 141 | Double &scantime,
|
---|
| 142 | Double &interval,
|
---|
| 143 | String &srcname,
|
---|
| 144 | String &fieldname,
|
---|
[2289] | 145 | Vector<Float> &spectra,
|
---|
| 146 | Vector<uChar> &flagtra,
|
---|
| 147 | Vector<Float> &tsys,
|
---|
| 148 | Vector<Double> &direction,
|
---|
[1757] | 149 | Float &azimuth,
|
---|
| 150 | Float &elevation,
|
---|
| 151 | Float ¶ngle,
|
---|
| 152 | Float &opacity,
|
---|
| 153 | uInt &tcalid,
|
---|
| 154 | Int &fitid,
|
---|
| 155 | uInt &focusid,
|
---|
| 156 | Float &temperature,
|
---|
| 157 | Float &pressure,
|
---|
| 158 | Float &humidity,
|
---|
| 159 | Float &windvel,
|
---|
| 160 | Float &winddir,
|
---|
| 161 | Double &srcvel,
|
---|
[2289] | 162 | Vector<Double> &propermotion,
|
---|
[1757] | 163 | Vector<Double> &srcdir,
|
---|
[2289] | 164 | Vector<Double> &scanrate ) ;
|
---|
[1757] | 165 |
|
---|
| 166 | // Get scan type
|
---|
| 167 | virtual string getScanType( int i ) ;
|
---|
| 168 |
|
---|
| 169 | // Get dataset
|
---|
[2764] | 170 | const NRODataset &dataset() { return *dataset_ ; }
|
---|
[1757] | 171 |
|
---|
| 172 | // Get number of rows
|
---|
| 173 | virtual Int getRowNum() ;
|
---|
| 174 |
|
---|
| 175 | // Get IF settings
|
---|
[2761] | 176 | virtual std::vector<Bool> getIFs() ;
|
---|
[1757] | 177 |
|
---|
[2154] | 178 | // Get Number of IFs
|
---|
| 179 | virtual Int getNumIF() = 0 ;
|
---|
| 180 |
|
---|
[1757] | 181 | // Get Beam settings
|
---|
[2761] | 182 | virtual std::vector<Bool> getBeams() ;
|
---|
[1757] | 183 |
|
---|
[2154] | 184 | // Get Number of Beams
|
---|
| 185 | virtual Int getNumBeam() = 0 ;
|
---|
| 186 |
|
---|
[1757] | 187 | protected:
|
---|
| 188 | // convert time in character representation to MJD representation
|
---|
| 189 | virtual double getMJD( char *time ) ;
|
---|
| 190 | virtual double getMJD( string strStartTime ) ;
|
---|
| 191 |
|
---|
| 192 | // Get spectrum
|
---|
[2761] | 193 | virtual std::vector< std::vector<double> > getSpectrum() ;
|
---|
[1757] | 194 |
|
---|
| 195 | // Get number of polarization
|
---|
| 196 | virtual Int getPolarizationNum() ;
|
---|
| 197 |
|
---|
| 198 | // Get MJD time
|
---|
| 199 | virtual double getStartTime() ;
|
---|
| 200 | virtual double getEndTime() ;
|
---|
[2761] | 201 | virtual std::vector<double> getStartIntTime() ;
|
---|
[1757] | 202 | //virtual double getStartIntTime( int i ) ;
|
---|
| 203 |
|
---|
| 204 | // Get Antenna Position in ITRF coordinate
|
---|
[2761] | 205 | virtual std::vector<double> getAntennaPosition() = 0 ;
|
---|
[1757] | 206 |
|
---|
| 207 | // Get SRCDIRECTION in RADEC(J2000)
|
---|
| 208 | virtual Vector<Double> getSourceDirection() ;
|
---|
| 209 |
|
---|
| 210 | // Get DIRECTION in RADEC(J2000)
|
---|
| 211 | virtual Vector<Double> getDirection( int i ) ;
|
---|
[2643] | 212 | virtual void initConvert( int icoord, double t, char *epoch ) ;
|
---|
[1757] | 213 |
|
---|
[2761] | 214 | // Shift frequency by given velocity with respect to specified
|
---|
| 215 | // velocity reference
|
---|
| 216 | std::vector<double> shiftFrequency( const std::vector<double> &f, const double &v, const string &vref ) ;
|
---|
| 217 |
|
---|
[1757] | 218 | // filename
|
---|
| 219 | string filename_ ;
|
---|
| 220 |
|
---|
| 221 | // dataset
|
---|
[2764] | 222 | CountedPtr<NRODataset> dataset_ ;
|
---|
[1757] | 223 |
|
---|
[2643] | 224 | // source direction
|
---|
| 225 | Vector<Double> srcdir_ ;
|
---|
| 226 | Vector<Double> msrcdir_ ;
|
---|
| 227 |
|
---|
| 228 | // for direction conversion
|
---|
| 229 | CountedPtr<MDirection::Convert> converter_ ;
|
---|
| 230 | CountedPtr<MeasFrame> mf_ ;
|
---|
[2761] | 231 | MEpoch me_ ;
|
---|
| 232 | MPosition mp_ ;
|
---|
[2643] | 233 | int coord_ ;
|
---|
| 234 |
|
---|
[2761] | 235 | bool freqRefFromVREF_ ;
|
---|
| 236 |
|
---|
[1757] | 237 | // Logger
|
---|
[2761] | 238 | LogIO os_ ;
|
---|
[1757] | 239 | };
|
---|
| 240 |
|
---|
| 241 | #endif /* NRO_READER_H */
|
---|