示例#1
0
文件: Start.hpp 项目: 333ccc/GnuRadar
         Hdf5Ptr SetupHDF5( gnuradar::File* file ) throw( H5::Exception )
         {

            Hdf5Ptr h5File_( new HDF5 ( file->basefilename() , hdf5::WRITE ) );

            h5File_->Description ( "GnuRadar Software" + file->version() );
            h5File_->WriteStrAttrib ( "START_TIME", currentTime.GetTime() );
            h5File_->WriteStrAttrib ( "INSTRUMENT", file->receiver() );
            h5File_->WriteAttrib<int> ( "CHANNELS", file->numchannels(),
                  H5::PredType::NATIVE_INT, H5::DataSpace() );
            h5File_->WriteAttrib<double> ( "SAMPLE_RATE", file->samplerate(),
                  H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
            h5File_->WriteAttrib<double> ( "BANDWIDTH", file->bandwidth(),
                  H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
            h5File_->WriteAttrib<int> ( "DECIMATION", file->decimation(),
                  H5::PredType::NATIVE_INT, H5::DataSpace() );
            h5File_->WriteAttrib<double> ( "OUTPUT_RATE", file->outputrate(),
                  H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
            h5File_->WriteAttrib<double> ( "IPP", file->pri(),
                  H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
            h5File_->WriteAttrib<double> ( "RF", file->txcarrier() , 
                  H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );

            for ( int i = 0; i < file->numchannels(); ++i ) {

               h5File_->WriteAttrib<double> ( 
                     "DDC" + lexical_cast<string> ( i ),
                     file->channel(i).frequency(), 
                     H5::PredType::NATIVE_DOUBLE, 
                     H5::DataSpace() 
                     );

               h5File_->WriteAttrib<double> ( 
                     "PHASE" + lexical_cast<string> ( i ),
                     file->channel(i).phase(), 
                     H5::PredType::NATIVE_DOUBLE, 
                     H5::DataSpace() 
                     );
            }

            h5File_->WriteAttrib<int> ( 
                  "SAMPLE_WINDOWS", file->window_size(),
                  H5::PredType::NATIVE_INT, H5::DataSpace()
                  );

            for ( int i = 0; i < file->window_size(); ++i ) {

               // TODO: Window Renaming scheme - 10/19/2010
               // Standardize window naming and add the user-defined
               // window name as a separate attribute.
               string idx = boost::lexical_cast<string> ( i );

               h5File_->WriteAttrib<int> ( 
                     "RxWin"+ idx + "_START", 
                     file->window(i).start(),
                     H5::PredType::NATIVE_INT, H5::DataSpace()
                     );

               h5File_->WriteAttrib<int> ( 
                     "RxWin" + idx + "_STOP", 
                     file->window(i).stop(),
                     H5::PredType::NATIVE_INT, H5::DataSpace()
                     );

               // update gnuradar shared buffer header
               header_->AddWindow( file->window(i).name(), file->window(i).start(), file->window(i).stop() );
            }

            return h5File_;
         }
示例#2
0
文件: Start.hpp 项目: cordic/GnuRadar
   Hdf5Ptr SetupHDF5( ConfigFile& configuration ) throw( H5::Exception )
   {
      std::string fileSet = configuration.DataFileBaseName();
      Hdf5Ptr h5File_( new HDF5 ( fileSet , hdf5::WRITE ) );

      h5File_->Description ( "GnuRadar Software" + configuration.Version() );
      h5File_->WriteStrAttrib ( "START_TIME", currentTime.GetTime() );
      h5File_->WriteStrAttrib ( "INSTRUMENT", configuration.Receiver() );
      h5File_->WriteAttrib<int> ( "CHANNELS", configuration.NumChannels(),
            H5::PredType::NATIVE_INT, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "SAMPLE_RATE", configuration.SampleRate(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "BANDWIDTH", configuration.Bandwidth(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<int> ( "DECIMATION", configuration.Decimation(),
            H5::PredType::NATIVE_INT, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "OUTPUT_RATE", configuration.OutputRate(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "IPP", configuration.IPP(),
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );
      h5File_->WriteAttrib<double> ( "RF", configuration.TxCarrier() , 
            H5::PredType::NATIVE_DOUBLE, H5::DataSpace() );

      for ( int i = 0; i < configuration.NumChannels(); ++i ) {

         h5File_->WriteAttrib<double> ( 
               "DDC" + lexical_cast<string> ( i ),
               configuration.DDC ( i ), 
               H5::PredType::NATIVE_DOUBLE, 
               H5::DataSpace() 
               );

         h5File_->WriteAttrib<double> ( 
               "PHASE" + lexical_cast<string> ( i ),
               configuration.Phase ( i ), 
               H5::PredType::NATIVE_DOUBLE, 
               H5::DataSpace() 
               );
      }

      h5File_->WriteAttrib<int> ( 
            "SAMPLE_WINDOWS", configuration.NumWindows(),
            H5::PredType::NATIVE_INT, H5::DataSpace()
            );

      for ( int i = 0; i < configuration.NumWindows(); ++i ) {

         // TODO: Window Renaming scheme - 10/19/2010
         // Standardize window naming and add the user-defined
         // window name as a separate attribute.

         h5File_->WriteAttrib<int> ( 
               configuration.WindowName ( i ) + "_START", 
               configuration.WindowStart ( i ),
               H5::PredType::NATIVE_INT, H5::DataSpace()
               );

         h5File_->WriteAttrib<int> ( 
               configuration.WindowName ( i ) + "_STOP", 
               configuration.WindowStop ( i ),
               H5::PredType::NATIVE_INT, H5::DataSpace()
               );

         // update gnuradar shared buffer header
         header_->AddWindow( configuration.WindowName(i),
               configuration.WindowStart(i),
               configuration.WindowStop(i)
               );
      }

      return h5File_;
   }