Logo coherent WaveBurst  
Library Reference Guide
Logo
testWDM_3.C
Go to the documentation of this file.
1 { // FFT of basis function from selected layer
2  int Rate = 1024; // sampling rate (Hz)
3  int Duration = 100; // duration (seconds)
4  int N = Rate*Duration; // number of samples
5  wavearray<double> ts(N); //time series container
6  ts.rate(Rate);
7 
8  // time series is filled with white noise data:
9  TRandom3 rnd(0);
10  for(int i=0; i<N; i++) ts[i] = rnd.Gaus();
11 
12  // produce the TF map:
13  WSeries<double> tfmap; // TF map container
14  WDM<double> wdm(32, 64, 4, 8); // define a WDM transform (32 bands)
15  tfmap.Forward(ts, wdm); // apply the WDM to the time series
16  watplot pl; // create canvas
17 
18 
19  // zero all bands except 3rd (24Hz - 40Hz)
20 
22  for(int i=0; i<=32; ++i)if(i!=2){
23  tfmap.getLayer(tmp, i);
24  tmp = 0;
25  tfmap.putLayer(tmp, i);
26  }
27 
28  tfmap.Inverse(); // inverse transform
29  tfmap.getLayer(tmp, 0); // move the time domain data in tmp
30  // fft of original ts
31  pl.plot(ts,const_cast<char*>("APL"),1,4.,ts.stop()-4.,true,0.,0.,true,1.);
32  // fft of extracted layer
33  pl.plot(tmp,const_cast<char*>("SAME"),2,4.,ts.stop()-4.,true,0.,0.,true,1.);
34 
35  return pl.canvas; // used by THtml doc
36 }
virtual void rate(double r)
Definition: wavearray.hh:141
watplot pl
WDM< double > wdm(nLAYERS, nLAYERS, 6, 10)
i drho i
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
Definition: watplot.cc:150
int Duration
Definition: testWDM_3.C:3
TCanvas * canvas
Definition: watplot.hh:192
double * tmp
Definition: testWDM_5.C:31
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
Definition: wseries.cc:193
WSeries< double > tfmap
wavearray< double > ts(N)
int N
Definition: testWDM_3.C:4
virtual void stop(double s)
Definition: wavearray.hh:139
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Definition: wseries.cc:246
TRandom3 rnd(0)
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
Definition: wseries.cc:291
void putLayer(wavearray< DataType_t > &, double n)
param: n - layer number
Definition: wseries.cc:219