Logo coherent WaveBurst  
Library Reference Guide
Logo
WDM.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko, Valentin Necula
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 // Wavelet Analysis Tool:
20 // Sergey Klimenko, University of Florida
21 //--------------------------------------------------------------------
22 // Implementation of
23 // Wilson-Daubechies transform
24 // References:
25 //--------------------------------------------------------------------
26 
27 
28 #ifndef WDM_HH
29 #define WDM_HH
30 
31 #include "SymmArray.hh"
32 #include "SymmArraySSE.hh"
33 #include "SymmObjArray.hh"
34 #include "WaveDWT.hh"
35 #include "wavearray.hh"
36 
37 #define MAXBETA 8
38 
39 template<class DataType_t> class SSeries;
40 
41 template<class DataType_t>
42 class WDM : public WaveDWT<DataType_t>
43 {
44 public:
45  // dummy constructor
46  WDM();
47 
48  // constructor
49  WDM(int, int, int, int);
50 
51  // WDMK constructor
52  WDM(int);
53 
54  //: copy constructors
55  WDM(const WDM &);
56 
57  //: destructor
58  virtual ~WDM();
59 
60  //: Duplicate on heap
61  virtual WDM* Clone() const;
62 
63  //: light-weight duplicate
64  virtual WDM* Init() const;
65 
66  // get maximum possible level of decomposition
67  int getMaxLevel();
68 
69  void forward(int, int);
70  void inverse(int, int);
71 
72  // get the time domain representation of the basis function corresponding to pixel (m,n)
73  // param1: frequency index
74  // param2: time index
75  // param3: where to store it
76  // returns translation constant (time shift not included in w)
77  int getBaseWave(int m, int n, SymmArray<double>& w);
78 
79  // same as above but for the quadrature
80  int getBaseWaveQ(int m, int n, SymmArray<double>& w);
81 
82  // get the time domain representation of the basis function corresponding to pixel j
83  // param1: pixel index
84  // param2: where to store it
85  // param3: Quadrature flag (true for quadrature)
86  // returns translation constant (sampling steps; time shift not included in w)
87  int getBaseWave(int j, wavearray<double>& w, bool Quad=false);
88 
89 
90  //: get array index of the first sample for (level,layer)
91  int getOffset(int, int);
92 
93  //: forward transfom
94  //: param: -1 - orthonormal, 0 - power map, >0 - upsampled map
95  void t2w(int);
96 
97  //: inverse transform (flag == -2 means do inverse of Quadrature)
98  void w2t(int flag);
99  void w2tQ(int);
100  // returns pixel amplitude
101  // param1: frequency index
102  // param2: time index
103  // param3: delay index
104  // param4: 00 phase - true, 90 phase - false
105  double getPixelAmplitude(int, int, int, bool=false);
106  double getPixelAmplitudeSSEOld(int, int, int, bool=false);
107  float getPixelAmplitudeSSE(int m, int n, int dT, bool Quad);
108  void getPixelAmplitudeSSE(int m, int n, int t1, int t2, float* r, bool Quad);
109 
110 
111  double TimeShiftTest(int dt);
112  double TimeShiftTestSSE(int dt);
113 
114  // override getTDamp from WaveDWT
115  // return time-delayed amplitudes for sample n and TD index m:
116  float getTDamp(int n, int m, char c='p');
117 
118 
119  // override getTDvec from WaveDWT
120  // return array of time-delayed amplitudes in the format:
121  // [-n*dt , 0, n*dt, -n*dt, 0, n*dt] - total 2(2n+1) amplitudes
122  // where n = k*LWDM (k - second parameter)
123  // param - index in TF map
124  // param - range of h(t) sample delays k
125  // param - 'a','A' - delayed amplitudes, 'p','P' - delayed power.
126  wavearray<float> getTDvec(int j, int K, char c='p');
127 
128  wavearray<float> getTDvecSSE(int j, int K, char c, SSeries<double>* pss);
129  //wavearray<float> getTDvecSSE(int j, int K, char c);
130 
131  // similar to getTDvec
132  void getTFvec(int j, wavearray<float>& r);
133 
134  // void transform2();
135  // double pixel(int f0, int t0);
136 
137  static double *Cos[MAXBETA], *Cos2[MAXBETA], *SinCos[MAXBETA];
139  static int objCounter;
140 
141  void initFourier();
142 
143  // getFilter(): returns 3 different WDM filters
144  // param1: filter length
145 
147  // set symmetric time-delay filter arrays used to calculate TD filter
148  void setTDFilter(int nCoeffs, int L=1); //L determines fractional increment tau/L
149  wavearray<double> getTDFilter2(int n, int L);
150  wavearray<double> getTDFilter1(int n, int L);
151 
152 
153  // override getSlice() from WaveDWT
154  std::slice getSlice(double n);
155 
156  void SetTFMap();
157  //double PrintTDFilters(int m, int dt, int nC);
158  // return size of global TD array
159  inline size_t Last(int n=0) { return T0.Last(); }
160  // return half size of TD filter
161  virtual size_t getTDFsize() { return T0.Last() ? T0[0].Last() : 0; }
162 
163 
164  int BetaOrder; // beta function order for Meyer
165  int precision; // wavelet precision
166  int KWDM; // K - parameter
167  int LWDM; // unit time delay is tau/LWDM where tau is 1/hot_rate
169 
170  SymmObjArray<SymmArraySSE<float> > T0; // time-delay filters
171  SymmObjArray<SymmArraySSE<float> > Tx; // time-delay filters
173 
174  DataType_t** TFMap00; //! pointer to 0-phase data, by default not initialized
175  DataType_t** TFMap90; //! pointer to 90-phase data, by default not initialized
176  void (*SSE_TDF)(); //!
177  float* td_buffer; //!
178  float* td_data; //!
180 
181 protected:
182  void initSSEPointers();
183 
184  ClassDef(WDM,2)
185 
186 }; // class WDM
187 
188 #endif // WDM_HH
189 
DataType_t ** TFMap00
Definition: WDM.hh:174
int getBaseWave(int m, int n, SymmArray< double > &w)
Definition: WDM.cc:323
void w2t(int flag)
Definition: WDM.cc:1539
wavearray< float > cosTD
Definition: WDM.hh:172
static double SinCosSize[MAXBETA]
Definition: WDM.hh:138
#define MAXBETA
Definition: WDM.hh:37
TH1 * t1
virtual size_t getTDFsize()
Definition: WDM.hh:161
virtual WDM * Init() const
Definition: WDM.cc:301
static double CosSize[MAXBETA]
Definition: WDM.hh:138
wavearray< float > getTDvecSSE(int j, int K, char c, SSeries< double > *pss)
Definition: WDM.cc:1201
unsigned int Last()
Definition: SymmObjArray.hh:40
int n
Definition: cwb_net.C:28
void initFourier()
Definition: WDM.cc:80
static double * SinCos[MAXBETA]
Definition: WDM.hh:137
static double * Cos2[MAXBETA]
Definition: WDM.hh:137
int m
Definition: cwb_net.C:28
int j
Definition: cwb_net.C:28
int getMaxLevel()
Definition: WDM.cc:1352
int BetaOrder
Definition: WDM.hh:164
SymmObjArray< SymmArraySSE< float > > Tx
Definition: WDM.hh:171
void setTDFilter(int nCoeffs, int L=1)
Definition: WDM.cc:639
void w2tQ(int)
Definition: WDM.cc:1631
double getPixelAmplitude(int, int, int, bool=false)
Definition: WDM.cc:748
void inverse(int, int)
Definition: WDM.cc:1376
int getOffset(int, int)
Definition: WDM.cc:1360
static int objCounter
Definition: WDM.hh:139
WDM()
Definition: WDM.cc:86
void getTFvec(int j, wavearray< float > &r)
Definition: WDM.cc:1277
wavearray< float > sinTDx
Definition: WDM.hh:172
wavearray< double > w
Definition: Test1.C:27
wavearray< float > getTDvec(int j, int K, char c='p')
Definition: WDM.cc:1159
double getPixelAmplitudeSSEOld(int, int, int, bool=false)
Definition: WDM.cc:833
int getBaseWaveQ(int m, int n, SymmArray< double > &w)
Definition: WDM.cc:374
static double Cos2Size[MAXBETA]
Definition: WDM.hh:138
wavearray< float > sinTD
Definition: WDM.hh:172
static double * Cos[MAXBETA]
Definition: WDM.hh:137
void SetTFMap()
Definition: WDM.cc:447
wavearray< double > getFilter(int n)
Definition: WDM.cc:498
virtual WDM * Clone() const
return: Wavelet* - duplicate of *this, allocated on heap
Definition: WDM.cc:292
wavearray< double > getTDFilter2(int n, int L)
Definition: WDM.cc:597
int LWDM
Definition: WDM.hh:167
float * td_data
Definition: WDM.hh:178
int KWDM
Definition: WDM.hh:166
void forward(int, int)
Definition: WDM.cc:1368
DataType_t ** TFMap90
pointer to 0-phase data, by default not initialized
Definition: WDM.hh:175
virtual ~WDM()
Definition: WDM.cc:273
void t2w(int)
Definition: WDM.cc:1385
void(* SSE_TDF)()
pointer to 90-phase data, by default not initialized
Definition: WDM.hh:176
float getPixelAmplitudeSSE(int m, int n, int dT, bool Quad)
Definition: WDM.cc:929
double dt
regression r
Definition: Regression_H1.C:44
Definition: WDM.hh:42
size_t Last(int n=0)
Definition: WDM.hh:159
double TimeShiftTest(int dt)
Definition: WDM.cc:1321
float getTDamp(int n, int m, char c='p')
Definition: WDM.cc:1103
wavearray< double > wdmFilter
Definition: WDM.hh:168
SymmArraySSE< float > td_halo[6]
Definition: WDM.hh:179
float * td_buffer
Definition: WDM.hh:177
std::slice getSlice(double n)
Definition: WDM.cc:463
wavearray< double > getTDFilter1(int n, int L)
Definition: WDM.cc:551
double TimeShiftTestSSE(int dt)
Definition: WDM.cc:1336
double dT
Definition: testWDM_5.C:12
int precision
Definition: WDM.hh:165
void initSSEPointers()
Definition: WDM.cc:701
SymmObjArray< SymmArraySSE< float > > T0
Definition: WDM.hh:170