Displaying a time-frequency plot

{
// Example of display of a waterfall. One extracts vectors from
// a set of files (with the help of a database), then
// fills an array of fft power versus time, transfers it in a 2D frame vector
// and displays it. The result may be seen  here 

   FrameH* fr;  // not mandatory to declare in a script
   Double_t time;
   Double_t periodog[128][256];
   
//---------------------------------------------
// First open a frame channel and extract a vector
//---------------------------------------------
   fc = new VFrameChannel("demoDB.root");
// Start time
   time = fc->GetStart();
   
//---------------------------------------------
// Build the waterfall
//---------------------------------------------
   Double_t timecur = time;
   
   for (int it=0;it<256;it++) {
//   extract a vector of length 256 bins (we know the sampling freqency !)
      vect = fc->GetVect("MYGO_ADC2",timecur,256*1e-4);
//   do the fft of it (by default with a hanning window)
      FrvRFFT* fft = FrvRFFTFor(0,vect);
//   draw the amplitude
      gVM->Draw(fft->amplitude);
      gPad->Modified();
      gPad->Update();
//   transfer the result into the final array
      for (int iy = 0;iy<128;iy++) {
         periodog[iy][it] = fft->amplitude->dataD[iy];
      }
//   go to the next vector after some cleaning
      FrVectFree(vect);
      FrvRFFTFree(fft);
//   shift the time interval
      timecur += 128*1e-4;
   }
   
//--------------------------------------------------------
// Transfer the 2D array in a 2D frame vector and plot it
//--------------------------------------------------------
   vect2 = VVectNew2D("Periodogram of ADC2",256,128,128*1e-4,1/(256*1e-4),
          time,&(periodog[0][0]),FR_VECT_8R,"Time[s]", "Frequency","Amplitude");
   gVM->Draw(vect2,"col");
}


- ROOT page - VEGA page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to , or contact with any questions or problems regarding ROOT or VEGA.