casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
NROReader.h
Go to the documentation of this file.
00001 //#---------------------------------------------------------------------------
00002 //# NROReader.h: Base class to read NRO 45m and ASTE data.
00003 //#---------------------------------------------------------------------------
00004 //# Copyright (C) 2000-2006
00005 //# Associated Universities, Inc. Washington DC, USA.
00006 //#
00007 //# This library is free software; you can redistribute it and/or modify it
00008 //# under the terms of the GNU Library General Public License as published by
00009 //# the Free Software Foundation; either version 2 of the License, or (at your
00010 //# option) any later version.
00011 //#
00012 //# This library is distributed in the hope that it will be useful, but WITHOUT
00013 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015 //# License for more details.
00016 //#
00017 //# You should have received a copy of the GNU Library General Public License
00018 //# along with this library; if not, write to the Free Software Foundation,
00019 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00020 //#
00021 //# Correspondence concerning AIPS++ should be addressed as follows:
00022 //#        Internet email: aips2-request@nrao.edu.
00023 //#        Postal address: AIPS++ Project Office
00024 //#                        National Radio Astronomy Observatory
00025 //#                        520 Edgemont Road
00026 //#                        Charlottesville, VA 22903-2475 USA
00027 //#
00028 //# $Id$
00029 //#---------------------------------------------------------------------------
00030 //# Original: 2008/10/30, Takeshi Nakazato, NAOJ
00031 //#---------------------------------------------------------------------------
00032 
00033 #ifndef NRO_READER_H
00034 #define NRO_READER_H
00035 
00036 #include <string>
00037 #include <stdio.h>
00038 #include <vector>
00039 
00040 #include <casa/aips.h>
00041 #include <casa/Arrays/Vector.h>
00042 #include <casa/BasicSL/String.h>
00043 #include <measures/Measures/MPosition.h>
00044 #include <measures/Measures/MCPosition.h>
00045 #include <measures/Measures/MDirection.h>
00046 #include <measures/Measures/MCDirection.h>
00047 #include <measures/Measures/MeasConvert.h>
00048 #include <measures/Measures/MeasFrame.h>
00049 #include <casa/Logging/LogIO.h>
00050 
00051 //#include <fitsio.h>
00052 
00053 #include <casa/namespace.h>
00054 
00055 #include <atnf/PKSIO/NRODataset.h>
00056 #include <atnf/PKSIO/NRODataRecord.h>
00057 
00058 using namespace std ;
00059 
00060 // <summary>
00061 // Base class to read NRO 45m and ASTE data.
00062 // </summary>
00063 // <use visibility=global>
00064 //
00065 // <prerequisite>
00066 //   <li> <linkto class=NRODataset>NRODataset</linkto>
00067 // </prerequisite>
00068 //
00069 // <reviewed reviewer="" date="" tests="" demos="">
00070 // </reviewed>
00071 //
00072 // <etymology>
00073 // <linkto class=NROReader>NROReader</linkto> is a base class for all NRO reader classes.
00074 // Reader classes have <linkto class=NRODataset>NRODataset</linkto> object to access 
00075 // actual data. These classes are a kind of interface for Scantable data filler. 
00076 // </etymology>
00077 //
00078 // <synopsis>
00079 // Abstract class that is designed as a base class for NRO reader classes. 
00080 // </synopsis>
00081 //
00082 
00083 // Open an appropriate NROreader for a NRO 45m and ASTE dataset.
00084 class NROReader *getNROReader( const String filename,
00085                                String &datatype );
00086 
00087 // As above, but search a list of directories for it.
00088 class NROReader *getNROReader( const String filename,
00089                                const Vector<String> directories,
00090                                int &iDir,
00091                                String &datatype ) ;
00092 
00093 // 
00094 // NROReader
00095 // 
00096 class NROReader
00097 {
00098  public:
00099   // Constructor 
00100   NROReader( string name ) ;
00101 
00102   // Destructor.
00103   virtual ~NROReader() ;
00104 
00105   // Read data header
00106   virtual Int read() = 0 ;
00107 
00108   // Get header information
00109   virtual int getHeaderInfo( Int &nchan,
00110                              Int &npol,
00111                              Int &nif,
00112                              Int &nbeam,
00113                              String &observer,
00114                              String &project,
00115                              String &obstype,
00116                              String &antname,
00117                              Vector<Double> &antpos,
00118                              Float &equinox,
00119                              String &freqref,
00120                              Double &reffreq,
00121                              Double &bw,
00122                              Double &utc,
00123                              String &fluxunit,
00124                              String &epoch,
00125                              String &poltype ) ;
00126                          
00127   // Get scan information
00128   virtual int getScanInfo( int irow,
00129                            uInt &scanno,
00130                            uInt &cycleno,
00131                            uInt &beamno,
00132                            uInt &polno,
00133                            vector<double> &freqs,   
00134                            Vector<Double> &restfreq,  
00135                            uInt &refbeamno,
00136                            Double &scantime,
00137                            Double &interval,
00138                            String &srcname,
00139                            String &fieldname,
00140                            Array<Float> &spectra,
00141                            Array<uChar> &flagtra,
00142                            Array<Float> &tsys,
00143                            Array<Double> &direction,
00144                            Float &azimuth,
00145                            Float &elevation,
00146                            Float &parangle,
00147                            Float &opacity,
00148                            uInt &tcalid,
00149                            Int &fitid,
00150                            uInt &focusid,
00151                            Float &temperature,  
00152                            Float &pressure,     
00153                            Float &humidity,     
00154                            Float &windvel,      
00155                            Float &winddir,      
00156                            Double &srcvel,
00157                            Array<Double> &propermotion,
00158                            Vector<Double> &srcdir,
00159                            Array<Double> &scanrate ) ;
00160 
00161   // Get scan type
00162   virtual string getScanType( int i ) ;
00163 
00164   // Get dataset
00165   virtual NRODataset *getDataset() { return dataset_ ; } ;
00166 
00167   // Get number of rows
00168   virtual Int getRowNum() ;
00169 
00170   // Get IF settings
00171   virtual vector<Bool> getIFs() ;
00172 
00173   // Get Beam settings
00174   virtual vector<Bool> getBeams() ;
00175 
00176  protected:
00177   // convert time in character representation to MJD representation
00178   virtual double getMJD( char *time ) ;
00179   virtual double getMJD( string strStartTime ) ;
00180 
00181   // Get spectrum
00182   virtual vector< vector<double> > getSpectrum() ;
00183 
00184   // Get number of polarization
00185   virtual Int getPolarizationNum() ;
00186 
00187   // Get MJD time
00188   virtual double getStartTime() ;
00189   virtual double getEndTime() ;
00190   virtual vector<double> getStartIntTime() ;
00191   //virtual double getStartIntTime( int i ) ;
00192 
00193   // Get Antenna Position in ITRF coordinate
00194   virtual vector<double> getAntennaPosition() = 0 ;
00195 
00196   // Get SRCDIRECTION in RADEC(J2000)
00197   virtual Vector<Double> getSourceDirection() ;
00198 
00199   // Get DIRECTION in RADEC(J2000)
00200   virtual Vector<Double> getDirection( int i ) ;
00201 
00202   // filename 
00203   string filename_ ;
00204 
00205   // dataset
00206   NRODataset *dataset_ ;
00207 
00208   // Logger
00209   //LogIO os ;
00210 };
00211 
00212 #endif /* NRO_READER_H */