casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
NROFITSDataset.h
Go to the documentation of this file.
00001 //#---------------------------------------------------------------------------
00002 //# NROFITSDataset.h: Class for NRO 45m FITS dataset.
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: 2009/02/27, Takeshi Nakazato, NAOJ
00031 //#---------------------------------------------------------------------------
00032 
00033 #ifndef NRO_FITS_DATASET_H
00034 #define NRO_FITS_DATASET_H
00035 
00036 #define NRO_FITS_ARYMAX 75
00037 
00038 #include <atnf/PKSIO/NRODataset.h>
00039 
00040 #include <string>
00041 
00042 using namespace std ;
00043 
00044 // <summary>
00045 // Accessor class for NRO 45m FITS data.
00046 // </summary>
00047 //
00048 // <prerequisite>
00049 //   <li> <linkto class=NRO45FITSReader>NRO45FITSReader</linkto>
00050 //   <li> <linkto class=NRODataset>NRODataset</linkto>
00051 // </prerequisite>
00052 //
00053 // <reviewed reviewer="" date="" tests="" demos="">
00054 // </reviewed>
00055 //
00056 // <etymology>
00057 // This class actually accesses data from NRO telescopes. This is specialized class 
00058 // for NRO 45m telescope with non-OTF observing mode. In contrast to other concrete classes, 
00059 // both fillHeader and fillRecord methods are implemented here. 
00060 // This is because that the output of non-OTF observing mode is in FITS format and is 
00061 // quite different format from that of OTF observing mode.
00062 // </etymology>
00063 //
00064 // <note>
00065 // Although the input data is FITS format, the class does not depend on cfitsio library.
00066 // </note>
00067 //
00068 // <synopsis>
00069 // Accessor class for NRO 45m FITS data.
00070 // </synopsis>
00071 //
00072 
00073 class NROFITSDataset : public NRODataset
00074 {
00075  public:
00076   // constructor
00077   NROFITSDataset( string name ) ;
00078 
00079   // destructor
00080   virtual ~NROFITSDataset() ;
00081 
00082   // data initialization 
00083   virtual void initialize() ;
00084 
00085   // fill header from file 
00086   virtual int fillHeader() ;
00087 
00088   // fill data record
00089   virtual  int fillRecord( int i ) ;
00090 
00091   // get various parameters
00092   virtual vector< vector<double> > getSpectrum() ;
00093   virtual vector<double> getSpectrum( int i ) ;
00094   virtual int getIndex( int irow ) ;
00095   virtual int getPolarizationNum() ;
00096   virtual uInt getArrayId( string type ) ;
00097   virtual double getStartIntTime( int i ) ;
00098 
00099  protected:
00100   // fill header information
00101   int fillHeader( int sameEndian ) ;
00102 
00103   // Read char data
00104   int readHeader( string &v, char *name ) ;
00105   int readTable( char *v, char *name ) ;
00106   int readTable( char *v, char *name, int clen, int idx ) ;
00107   int readTable( vector<char *> &v, char *name, int idx ) ;
00108   int readColumn( vector<string> &v, char *name ) ;
00109   int readColumn( vector<string> &v, char *name, int idx ) ;
00110 
00111   // Read int data
00112   int readHeader( int &v, char *name, int b ) ;
00113   int readTable( int &v, char *name, int b ) ;
00114   int readTable( int &v, char *name, int b, int idx ) ;
00115   int readTable( vector<int> &v, char *name, int b, int idx ) ;
00116   int readColumn( vector<int> &v, char *name, int b ) ;
00117   int readColumn( vector<int> &v, char *name, int b, int idx ) ;
00118 
00119   // Read float data
00120   int readHeader( float &v, char *name, int b ) ;
00121   int readTable( float &v, char *name, int b ) ;
00122   int readTable( float &v, char *name, int b, int idx ) ;
00123   int readTable( vector<float> &v, char *name, int b, int idx ) ;
00124   int readColumn( vector<float> &v, char *name, int b ) ;
00125   int readColumn( vector<float> &v, char *name, int b, int idx ) ;
00126 
00127   // Read double data
00128   int readHeader( double &v, char *name, int b ) ;
00129   int readTable( double &v, char *name, int b ) ;
00130   int readTable( double &v, char *name, int b, int idx ) ;
00131   int readTable( vector<double> &v, char *name, int b, int idx ) ;
00132   int readColumn( vector<double> &v, char *name, int b ) ;
00133   int readColumn( vector<double> &v, char *name, int b, int idx ) ;
00134 
00135   // read ARRY
00136   int readARRY() ;
00137 
00138   // Convert RA character representation to radian
00139   double radRA( string ra ) ;
00140   
00141   // Convert DEC character representation to radian
00142   double radDEC( string dec ) ;
00143 
00144   // get field parameters for scan header
00145   void getField() ;
00146 
00147   // fill array type
00148   void fillARYTP() ;
00149 
00150   // find data for each ARYTP
00151   void findData() ;
00152 
00153   // get offset bytes for attributes
00154   int getOffset( char *name ) ;
00155 
00156   // convert frequency frame
00157 //   virtual double toLSR( double v, double t, double x, double y ) ;
00158 
00159   // number of column for scan header
00160   int numField_ ;
00161 
00162   // number of HDU
00163   int numHdu_ ;
00164 
00165   // array type
00166   vector<string> ARYTP ;
00167 
00168   // reference index
00169   vector<int> arrayid_ ;
00170 
00171   // field names
00172   vector<string> forms_ ;
00173   
00174   // field types
00175   vector<string> names_ ;
00176 
00177   // field units
00178   vector<string> units_ ;
00179 
00180   // spectral data
00181   vector<int> JDATA ;
00182 } ;
00183 
00184 
00185 #endif /* NRO_FITS_DATASET_H */