Logo coherent WaveBurst  
Library Reference Guide
Logo
TestFrame6.C
Go to the documentation of this file.
1 //
2 // Test Resampling Sata to Power of 2
3 // Author : Gabriele Vedovato
4 
5 {
6  #define N_IFO 1
7 
9 
10  TString ifo[N_IFO]={"L1"};
11  CWB::mdc MDC(N_IFO,ifo);
12 
13 // wavearray<double> w = MDC.GetSGQ(554., 8.9);
14 // wavearray<double> w = MDC.GetWNB(3500., 1000., 0.01);
15  wavearray<double> w = MDC.GetWNB(500., 4000., 0.01);
16  cout << endl;
17  cout << "w srate " << w.rate() << endl;
18  cout << "w start " << w.start() << endl;
19  cout << "w stop " << w.stop() << endl;
20  cout << "w size " << w.size() << endl;
21  cout << endl;
22 
23  // resampling
24  double srate = 2*4300;
26 
27  ww.FFTW(1);
28  ww.resize(srate);
29  ww.FFTW(-1);
30  ww.rate(srate);
31 
32  cout << endl;
33  cout << "ww srate " << ww.rate() << endl;
34  cout << "ww start " << ww.start() << endl;
35  cout << "ww stop " << ww.stop() << endl;
36  cout << "ww size " << ww.size() << endl;
37  cout << endl;
38 
39  fr.resample(ww,11);
40  cout << endl;
41  cout << "resampled ww srate " << ww.rate() << endl;
42  cout << "resampled ww start " << ww.start() << endl;
43  cout << "resampled ww stop " << ww.stop() << endl;
44  cout << "resampled ww size " << ww.size() << endl;
45  cout << endl;
46 
47  watplot plot(const_cast<char*>("plot"),200,20,800,500);
48 
49  char gtitle[256];
50  sprintf(gtitle,"Original PSD (Black) Reasampled PSD (Red)");
51  plot.gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}");
52  plot.goptions(const_cast<char*>("alp logy"), 1, 0, 0, true, 0,w.rate()/2., true, 32);
53 
54  w >> plot; ww >> plot;
55 
56 /*
57  char ofName[256];
58  sprintf(ofName,"ResamplePSD.png");
59  cout << "write results to " << ofName << endl;
60  TString gfile=ofName;
61  plot >> gfile;
62 
63  exit(0);
64 */
65 }
CWB::mdc MDC(N_IFO, ifo)
virtual void rate(double r)
Definition: wavearray.hh:141
TString("c")
CWB::frame fr(FRLIST_NAME)
plot gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}")
virtual void start(double s)
Definition: wavearray.hh:137
wavearray< double > w
Definition: TestFrame6.C:15
virtual size_t size() const
Definition: wavearray.hh:145
cout<< endl;cout<< "w srate "<< w.rate()<< endl;cout<< "w start "<< w.start()<< endl;cout<< "w stop "<< w.stop()<< endl;cout<< "w size "<< w.size()<< endl;cout<< endl;double srate=2 *4300;wavearray< double > ww
Definition: TestFrame6.C:25
Definition: mdc.hh:248
wavearray< double > GetWNB(double frequency, double bandwidth, double duration, int seed=0, bool mode=0)
Definition: mdc.cc:3053
virtual void FFTW(int=1)
Definition: wavearray.cc:896
virtual void stop(double s)
Definition: wavearray.hh:139
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
#define N_IFO
cout<< endl;cout<< "ww srate "<< ww.rate()<< endl;cout<< "ww start "<< ww.start()<< endl;cout<< "ww stop "<< ww.stop()<< endl;cout<< "ww size "<< ww.size()<< endl;cout<< endl;fr.resample(ww, 11);cout<< endl;cout<< "resampled ww srate "<< ww.rate()<< endl;cout<< "resampled ww start "<< ww.start()<< endl;cout<< "resampled ww stop "<< ww.stop()<< endl;cout<< "resampled ww size "<< ww.size()<< endl;cout<< endl;watplot plot(const_cast< char * >"plot"), 200, 20, 800, 500);char gtitle[256];sprintf(gtitle,"Original PSD (Black) Reasampled PSD (Red)");plot.gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}");plot.goptions(const_cast< char * >"alp logy"), 1, 0, 0, true, 0, w.rate()/2., true, 32);w > plot
Definition: TestFrame6.C:54
virtual void resize(unsigned int)
Definition: wavearray.cc:463
TString ifo[N_IFO]
Definition: TestFrame6.C:10