Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestRegressionFrame.C
Go to the documentation of this file.
1 #define FRLIST_TARGET "input/H1_LDAS_C02_L2.frl"
2 #define FRLIST_WITNESS "input/H1_RDS_R_L1.frl"
3 
4 #define nWITNESS 9
5 #define SCRATCH 8.
6 #define dFREQ 0.5
7 //#define dFREQ 1.0
8 
9 //#define LINE_60HZ
10 //#define LINE_120HZ
11 #define LINE_180HZ
12 
13 #define GPS 942449664
14 #define LENGTH 616
15 
16 #define nFILTER 2
17 
18 using namespace CWB;
20 
22 
23  TString target = "H1:LDAS-STRAIN";
24 
25  TString witness[nWITNESS] = {
26  "H0:PEM-BSC10_MAGX",
27  "H1:SUS-ETMX_COIL_LL",
28  "H1:SUS-ETMX_COIL_LR",
29  "H1:SUS-ETMX_COIL_UL",
30  "H1:SUS-ETMX_COIL_UR",
31  "H1:SUS-ITMX_COIL_LL",
32  "H1:SUS-ITMX_COIL_LR",
33  "H1:SUS-ITMX_COIL_UL",
34  "H1:SUS-ITMX_COIL_UR"
35  };
36 
37 #ifdef LINE_60HZ
38  double fLow=50; double fHigh=70;
39 #endif
40 #ifdef LINE_120HZ
41  double fLow=110; double fHigh=130;
42 #endif
43 #ifdef LINE_180HZ
44  double fLow=170; double fHigh=190;
45 #endif
46 
47  // declare watplot
48  plot = new watplot(const_cast<char*>("plot"),200,20,800,500);
49  plot->goptions(const_cast<char*>("alp logy"), 1, 0., 0., true, fLow, fHigh, true, 64);
50 
51  // read target data
53  xx.start(GPS); xx.stop(GPS+LENGTH);
54 
55  frame frt(FRLIST_TARGET,target);
56  frt >> xx;
57 
58  // read witness data
61  for(int n=0;n<nWITNESS;n++) {
62  yy[n] = new wavearray<double>;
63  yy[n]->start(GPS); yy[n]->stop(GPS+LENGTH);
64  frw.setChName(witness[n]);
65  frw >> *yy[n];
66  cout << "yy : " << n << " " << yy[n]->size() << " " << yy[n]->rate() << endl;
67  }
68 
69  // resample target 16384Hz -> 2048Hz
70  Biorthogonal<double> Bio(512);
71  WSeries<double> wT(Bio);
72  wT.Forward(xx,3);
73  wT.getLayer(xx,0);
74 
75  int level=xx.rate()/(2*dFREQ);
76  WDM<double> WD(level, level, 4, 12);
77 
78  wT.Forward(xx,WD);
79  wT.setlow(fLow);
80  wT.sethigh(fHigh);
81  regression rr(wT,const_cast<char*>("target"));
82  for(int n=0;n<nWITNESS;n++) rr.add(*yy[n],const_cast<char*>("witness"));
83  for(int n=2;n<=nWITNESS;n++) rr.add(1,n,const_cast<char*>("bi-witness"));
84  for(int n=2;n<=nWITNESS;n++) rr.mask(n);
85 
86  rr.setFilter(nFILTER);
87  rr.setMatrix(SCRATCH,1.);
88  rr.solve(0.,0,'h');
89  //rr.solve(0.,nWITNESS,'h');
90  rr.apply();
91 
92  wavearray<double> nn = rr.getNoise();
93  wavearray<double> cc = rr.getClean();
94 
95  xx >> *plot;
96  cc >> *plot;
97 
98 #ifdef LINE_60HZ
99  plot->gtitle("H1 regression @ 60Hz");
100  *plot >> const_cast<char*>("H1_regression_60Hz.png");
101 #endif
102 #ifdef LINE_120HZ
103  plot->gtitle("H1 regression @ 120Hz");
104  *plot >> const_cast<char*>("H1_regression_1200Hz.png");
105 #endif
106 #ifdef LINE_180HZ
107  plot->gtitle("H1 regression @ 180Hz");
108  *plot >> const_cast<char*>("H1_regression_180Hz.png");
109 #endif
110 
111 }
void sethigh(double f)
Definition: wseries.hh:114
virtual size_t size() const
Definition: wavearray.hh:127
void gtitle(TString title="", TString xtitle="", TString ytitle="")
Definition: watplot.cc:1237
void setMatrix(double edge=0., double f=1.)
Definition: regression.cc:407
Definition: ced.hh:24
double fHigh
wavearray< double > target
int n
Definition: cwb_net.C:10
wavearray< double > getNoise()
Definition: regression.hh:123
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
TString("c")
frame frt(FRLIST_NAME, HCHANNEL)
void setlow(double f)
Definition: wseries.hh:107
size_t add(WSeries< double > &target, char *name, double fL=0., double fH=0.)
Definition: regression.cc:73
virtual void start(double s)
Definition: wavearray.hh:119
#define FRLIST_TARGET
#define nWITNESS
#define LENGTH
void setChName(TString chName)
Definition: frame.hh:102
void TestRegressionFrame()
wavearray< double > xx
Definition: TestFrame1.C:11
#define nFILTER
void apply(double threshold=0., char c='a')
Definition: regression.cc:691
#define dFREQ
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
Definition: wseries.cc:175
watplot * plot
void goptions(char *opt=NULL, int col=1, double t1=0., double t2=0., bool fft=false, float f1=0., float f2=0., bool psd=false, float t3=0., bool oneside=false)
Definition: watplot.cc:1202
void solve(double th, int nE=0, char c='s')
Definition: regression.cc:592
size_t setFilter(size_t)
Definition: regression.cc:258
#define FRLIST_WITNESS
wavearray< double > getClean()
Definition: regression.hh:117
wavearray< double > yy
Definition: TestFrame5.C:12
#define GPS
double fLow
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
void mask(int n, double flow=0., double fhigh=0.)
Definition: regression.cc:303
frame frw(FRLIST_NAME2)
#define SCRATCH