Data Access Library (DAL)
/home/amesfoort/DAL/dal/lofar/BF_File.h
00001 /* Copyright 2011-2012  ASTRON, Netherlands Institute for Radio Astronomy
00002  * This file is part of the Data Access Library (DAL).
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either 
00007  * version 3 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public 
00015  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef DAL_BF_FILE_H
00018 #define DAL_BF_FILE_H
00019 
00020 #include <string>
00021 #include <vector>
00022 #include <hdf5.h>
00023 #include "CLA_File.h"
00024 #include "Coordinates.h"
00025 #include "../hdf5/Dataset.h"
00026 
00027 namespace dal {
00028 
00029 class BF_File;
00030 class BF_SysLog;
00031 class BF_ProcessingHistory;
00032 class BF_SubArrayPointing;
00033 class BF_BeamGroup;
00034 class BF_StokesDataset;
00035 
00039 class BF_File: public CLA_File {
00040 public:
00041   BF_File();
00042 
00046   BF_File( const std::string &filename, FileMode mode = READ );
00047 
00048   virtual ~BF_File();
00049 
00050   virtual void open( const std::string &filename, FileMode mode = READ );
00051   virtual void close();
00052 
00053   Attribute<std::string>  createOfflineOnline();
00054   Attribute<std::string>  BFFormat();
00055   Attribute<std::string>  BFVersion();
00056 
00057   Attribute<double>       totalIntegrationTime();
00058   Attribute<std::string>  totalIntegrationTimeUnit();
00059   
00060   Attribute<std::string>  observationDatatype();
00061 
00062   Attribute<double>       subArrayPointingDiameter();
00063   Attribute<std::string>  subArrayPointingDiameterUnit();
00064   Attribute<double>       bandwidth();
00065   Attribute<std::string>  bandwidthUnit();
00066   Attribute<double>       beamDiameter();
00067   Attribute<std::string>  beamDiameterUnit();
00068 
00069   Attribute<unsigned>     observationNofSubArrayPointings();
00070   Attribute<unsigned>     nofSubArrayPointings();
00071   virtual BF_SubArrayPointing subArrayPointing( unsigned nr );
00072 
00073   BF_SysLog               sysLog();
00074 
00075 protected:
00076   std::string             subArrayPointingName( unsigned nr );
00077 
00078 private:
00079   void                    openFile( FileMode mode );
00080   void                    initFileNodes();
00081 };
00082 
00083 class BF_SysLog: public Group {
00084 public:
00085   BF_SysLog( Group &parent, const std::string &name ): Group(parent, name) {}
00086 };
00087 
00088 class BF_ProcessingHistory: public Group {
00089 public:
00090   BF_ProcessingHistory( Group &parent, const std::string &name ): Group(parent, name) {}
00091 };
00092 
00093 class BF_SubArrayPointing: public Group {
00094 public:
00095   BF_SubArrayPointing( Group &parent, const std::string &name );
00096 
00097   Attribute<std::string>  expTimeStartUTC();
00098   Attribute<std::string>  expTimeEndUTC();
00099 
00100   Attribute<double>       expTimeStartMJD();
00101   Attribute<double>       expTimeEndMJD();
00102 
00103   Attribute<double>       totalIntegrationTime();
00104   Attribute<std::string>  totalIntegrationTimeUnit();
00105 
00106   Attribute<double>       pointRA();
00107   Attribute<std::string>  pointRAUnit();  
00108   Attribute<double>       pointDEC();
00109   Attribute<std::string>  pointDECUnit();  
00110 
00111   Attribute< std::vector<double> >       pointAltitude();
00112   Attribute< std::vector<std::string> >  pointAltitudeUnit();  
00113   Attribute< std::vector<double> >       pointAzimuth();
00114   Attribute< std::vector<std::string> >  pointAzimuthUnit();  
00115 
00116   Attribute<unsigned>     observationNofBeams();
00117   Attribute<unsigned>     nofBeams();
00118 
00119   virtual BF_ProcessingHistory processHistory();
00120 
00121   virtual BF_BeamGroup    beam( unsigned nr );
00122 
00123 protected:
00124   std::string             beamName( unsigned nr );
00125 
00126   virtual void            initNodes();
00127 };
00128 
00129 class BF_BeamGroup: public Group {
00130 public:
00131   BF_BeamGroup( Group &parent, const std::string &name );
00132 
00133   Attribute< std::vector<std::string> >  targets();
00134 
00135   Attribute<unsigned>     nofStations();
00136 
00137   Attribute< std::vector<std::string> > stationsList();
00138 
00139   Attribute<unsigned>     nofSamples();
00140   Attribute<double>       samplingRate();
00141   Attribute<std::string>  samplingRateUnit();
00142   Attribute<double>       samplingTime();
00143   Attribute<std::string>  samplingTimeUnit();
00144 
00145   Attribute<unsigned>     channelsPerSubband();
00146   Attribute<double>       subbandWidth();
00147   Attribute<std::string>  subbandWidthUnit();
00148 
00149   Attribute<double>       channelWidth();
00150   Attribute<std::string>  channelWidthUnit();
00151 
00152   Attribute<std::string>  tracking();
00153 
00154   Attribute<double>       pointRA();
00155   Attribute<std::string>  pointRAUnit();    
00156   Attribute<double>       pointDEC();
00157   Attribute<std::string>  pointDECUnit();  
00158   
00159   Attribute<double>       pointOffsetRA();
00160   Attribute<std::string>  pointOffsetRAUnit();  
00161   Attribute<double>       pointOffsetDEC();
00162   Attribute<std::string>  pointOffsetDECUnit();  
00163 
00164   Attribute<double>       beamDiameterRA();
00165   Attribute<std::string>  beamDiameterRAUnit();
00166   Attribute<double>       beamDiameterDEC();
00167   Attribute<std::string>  beamDiameterDECUnit();
00168   Attribute<double>       beamFrequencyCenter();
00169   Attribute<std::string>  beamFrequencyCenterUnit();
00170 
00171   Attribute<bool>         foldedData();
00172   Attribute<double>       foldPeriod();
00173   Attribute<std::string>  foldPeriodUnit();
00174 
00175   Attribute<std::string>  dedispersion();
00176   Attribute<double>       dispersionMeasure();
00177   Attribute<std::string>  dispersionMeasureUnit();
00178 
00179   Attribute<bool>         barycentered();
00180 
00181   Attribute<unsigned>     observationNofStokes();
00182   Attribute<unsigned>     nofStokes();
00183   Attribute< std::vector<std::string> > stokesComponents();
00184   Attribute<bool>         complexVoltage();
00185   Attribute<std::string>  signalSum();
00186 
00187   virtual BF_ProcessingHistory processHistory();
00188 
00189   virtual CoordinatesGroup coordinates();
00190 
00191   virtual BF_StokesDataset stokes( unsigned nr );
00192 
00193 protected:
00194   std::string             stokesName( unsigned nr );
00195   std::string             coordinatesName();
00196 
00197   virtual void            initNodes();
00198 };
00199 
00200 class BF_StokesDataset: public Dataset<float> {
00201 public:
00202   BF_StokesDataset( Group &parent, const std::string &name );
00203 
00204   Attribute<std::string>  dataType();
00205 
00206   Attribute<std::string>  stokesComponent();
00207   Attribute< std::vector<unsigned> >    nofChannels();
00208   Attribute<unsigned>     nofSubbands();
00209   Attribute<unsigned>     nofSamples();
00210 
00211 protected:
00212   virtual void            initNodes();
00213 };
00214 
00215 }
00216 
00217 #endif
00218 
 All Classes Functions Variables Typedefs Friends