Data Access Library (DAL)
/home/amesfoort/DAL/dal/lofar/TBB_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_TBB_FILE_H
00018 #define DAL_TBB_FILE_H
00019 
00020 #include <string>
00021 #include <vector>
00022 #include <complex>
00023 #include <hdf5.h>
00024 #include "CLA_File.h"
00025 #include "Flagging.h"
00026 #include "../hdf5/Dataset.h"
00027 
00028 namespace dal {
00029 
00030 class TBB_File;
00031 class TBB_Station;
00032 class TBB_DipoleDataset;
00033 class TBB_Trigger;
00034 
00038 class TBB_File: public CLA_File {
00039 public:
00040   TBB_File();
00041 
00045   TBB_File( const std::string &filename, FileMode mode = READ );
00046 
00047   virtual ~TBB_File();
00048 
00049   virtual void open( const std::string &filename, FileMode mode = READ );
00050   virtual void close();
00051 
00052   Attribute<std::string> operatingMode();
00053   Attribute<unsigned>    nofStations();
00054 
00055   virtual std::vector<TBB_Station> stations();
00056   virtual TBB_Station    station( const std::string &stationName );
00057 
00058   virtual TBB_Trigger    trigger();
00059 
00060 private:
00061   void                   openFile( FileMode mode );
00062   void                   initFileNodes();
00063 
00064   std::string            stationGroupName( const std::string &stationName );
00065 };
00066 
00067 class TBB_Trigger: public Group {
00068 public:
00069   TBB_Trigger( Group &parent, const std::string &name );
00070 
00071   Attribute<std::string> triggerType();
00072   Attribute<int>         triggerVersion();
00073 
00074   Attribute<int>         paramCoincidenceChannels();
00075   Attribute<double>      paramCoincidenceTime();
00076   Attribute<std::string> paramDirectionFit();
00077   Attribute<double>      paramElevationMin();
00078   Attribute<double>      paramFitVarianceMax();
00079 
00080 protected:
00081   virtual void           initNodes();
00082 };
00083 
00084 class TBB_Station: public Group {
00085 public:
00086   TBB_Station( Group &parent, const std::string &name );
00087 
00088   Attribute<std::string>                stationName();
00089 
00090   Attribute< std::vector<double> >      stationPosition();
00091   Attribute<std::string>                stationPositionUnit();
00092   Attribute<std::string>                stationPositionFrame();
00093 
00094   Attribute< std::vector<double> >      beamDirection();
00095   Attribute<std::string>                beamDirectionUnit();
00096   Attribute<std::string>                beamDirectionFrame();
00097 
00098   Attribute<double>                     clockOffset();
00099   Attribute<std::string>                clockOffsetUnit();
00100 
00101   Attribute<unsigned>                   nofDipoles();
00102 
00103   virtual std::vector<TBB_DipoleDataset> dipoles();
00104   virtual TBB_DipoleDataset             dipole( unsigned stationID, unsigned rspID, unsigned rcuID );
00105 
00106 private:
00107   std::string                           dipoleDatasetName( unsigned stationID, unsigned rspID, unsigned rcuID );
00108 
00109 protected:
00110   virtual void                          initNodes();
00111 };
00112 
00113 class TBB_DipoleDataset: public Dataset<short> {
00114 public:
00115   TBB_DipoleDataset( Group &parent, const std::string &name );
00116 
00117   Attribute<unsigned>                   stationID();
00118   Attribute<unsigned>                   rspID();
00119   Attribute<unsigned>                   rcuID();
00120 
00121   Attribute<double>                     sampleFrequency();
00122   Attribute<std::string>                sampleFrequencyUnit();
00123 
00124   Attribute<unsigned>                   time();
00125   Attribute<unsigned>                   sampleNumber();
00126 
00127   Attribute<unsigned>                   samplesPerFrame();
00128   Attribute<unsigned long long>         dataLength();
00129   Attribute< std::vector<Range> >       flagOffsets();
00130   Attribute<unsigned>                   nyquistZone();
00131 
00132   Attribute<double>                     cableDelay();
00133   Attribute<std::string>                cableDelayUnit();
00134 
00135   Attribute<double>                     dipoleCalibrationDelay();
00136   Attribute<std::string>                dipoleCalibrationDelayUnit();
00137   Attribute< std::vector<std::complex<double> > > dipoleCalibrationGainCurve();
00138 
00139   Attribute< std::vector<double> >      antennaPosition();
00140   Attribute<std::string>                antennaPositionUnit();
00141   Attribute<std::string>                antennaPositionFrame();
00142   Attribute< std::vector<double> >      antennaNormalVector();
00143   Attribute< std::vector<double> >      antennaRotationMatrix(); // 3 x 3, row-minor
00144 
00145   Attribute< std::vector<double> >      tileBeam();
00146   Attribute<std::string>                tileBeamUnit();
00147   Attribute<std::string>                tileBeamFrame();
00148 
00149   Attribute<double>                     dispersionMeasure();
00150   Attribute<std::string>                dispersionMeasureUnit();
00151 
00152 protected:
00153   virtual void                          initNodes();
00154 };
00155 
00156 }
00157 
00158 #endif
00159 
 All Classes Functions Variables Typedefs Friends