Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
testWDM_4.C
Go to the documentation of this file.
1 { // apply transformation on white noise and produce a power spectral density plot
2 
3  int Rate = 1024; // sampling rate (Hz)
4  int Duration = 100; // duration (seconds)
5  int N = Rate*Duration; // number of samples
6  wavearray<double> ts(N); //time series container
7  ts.rate(Rate);
8 
9  // time series is filled with white noise data:
10  // add a sine wave @ 200Hz:
11  double T = 1./Rate;
12  double omega = TMath::TwoPi()*200;
13  for(int i=0; i<N; i++) ts[i] += sin(omega*i*T);
14  TRandom3 rnd(0);
15  for(int i=0; i<N; i++) {
16  ts[i] = rnd.Gaus();
17  ts[i] += sin(omega*i*T);
18  }
19 
20  // produce the TF map:
21  WDM<double> wdm(32, 64, 4, 8); // define a WDM transform (32 bands)
22  WSeries<double> tfmap; // TF map container
23  tfmap.Forward(ts, wdm, 0); // apply the WDM to the time series
25 
26  // fft of original ts
27  pl.plot(ts,const_cast<char*>("APL"),1,4.,ts.stop()-4.,true,0.,0.,true,1./16);
28 
29  // compute PSD
32  psd.rate(1./16);
33  for(int i=0; i<=32; ++i){
34  tfmap.getLayer(x, i);
35  psd.data[i] = x.mean()/Rate;
36  //printf("%d\n", tmp.size());
37  if(i==0 || i==32) psd.data[i] *= 2;
38  psd.data[i] = sqrt(psd.data[i]);
39  }
40  pl.plot(psd,const_cast<char*>("SAME"),2);
41 }
virtual void rate(double r)
Definition: wavearray.hh:123
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
WDM< double > wdm(32, 64, 4, 8)
wavearray< double > psd(33)
i drho i
TRandom3 rnd(1)
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:132
virtual double mean() const
Definition: wavearray.cc:1053
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
Definition: wseries.cc:175
int Rate
int Duration
Definition: testWDM_4.C:4
double T
Definition: testWDM_4.C:11
watplot pl
Definition: testWDM_4.C:24
virtual void stop(double s)
Definition: wavearray.hh:121
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Definition: wseries.cc:228
double omega
Definition: testWDM_4.C:12
wavearray< double > ts(N)
DataType_t * data
Definition: wavearray.hh:301
WSeries< double > tfmap
Definition: testWDM_4.C:22
wavearray< double > x
Definition: testWDM_4.C:30
int N
Definition: testWDM_4.C:5