Logo coherent WaveBurst  
Library Reference Guide
Logo
WaveDWT.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 //$Id: WaveDWT.hh,v 1.3 2001/12/15 03:27:29 jzweizig Exp $
21 #ifndef WAVEDWT_HH
22 #define WAVEDWT_HH
23 
24 //#include "slice.h"
25 //#include <valarray>
26 #ifndef __CINT__
27 #include <valarray>
28 #else
29 namespace std {
30  class slice;
31 }
32 #endif
33 #include "Wavelet.hh"
34 #include "wavearray.hh"
35 #include "TNamed.h"
36 #include "TBuffer.h"
37 
38 //namespace datacondAPI {
39 //namespace wat {
40 
41 template<class DataType_t> class SSeries;
42 
43 template<class DataType_t>
44 class WaveDWT : public Wavelet
45 {
46  public:
47 
48  //: constructor
49  WaveDWT(int mH=1, int mL=1, int tree=0, enum BORDER border=B_CYCLE);
50 
51  //: construct from the base class
52  WaveDWT(const Wavelet &);
53 
54  //: copy constructor
56 
57  //: Destructor
58  virtual ~WaveDWT();
59 
60  //: duplicate on heap - uses copy constructor
61  virtual WaveDWT<DataType_t>* Clone() const;
62 
63  //: light-weight duplicate
64  virtual WaveDWT<DataType_t>* Init() const {return this->Clone();}
65 
66  //: get maximum possible level of wavelet decompostion
67  virtual int getMaxLevel();
68  virtual int getMaxLevel (int i) {return Wavelet::getMaxLevel(i);}
69 
70  //: make slice for layer with specified index
71  virtual std::slice getSlice(const double);
72 
73  //: make slice for (level,layer)
74  virtual std::slice getSlice(const int, const int);
75 
76  virtual float getTDamp(int j, int k, char c='p') {
77  // return time-delayed amplitude for delay index k
78  // should be implemented in the transformation class (see WDM.hh)
79  float x;
80  if(j>=0 && j<(int)nWWS) x = c=='a' || c=='A' ? pWWS[j] : pWWS[j]*pWWS[j];
81  return x;
82  }
83 
84  virtual wavearray<float> getTDvec(int j, int k, char c='p') {
85  //: return array of time-delayed amplitudes between -k : k
86  //: should be implemented in the transformation class (see WDM.hh)
88  if(j>=0 && j<(int)nWWS) x.data[0] = c=='a' || c=='A' ? pWWS[j] : pWWS[j]*pWWS[j];
89  return x;
90  }
91 
92  virtual wavearray<float> getTDvecSSE(int j, int k, char c, SSeries<double>* pss){
93  //: return array of time-delayed amplitudes between -k : k
94  //: should be implemented in the transformation class (see WDM.hh)
96  cout<<"I am getTDvecSSE in WaveDWT\n";
97  return x;
98  }
99 
100  //: fills r with amplitudes needed to compute time-delays (for both quadratures)
101  virtual void getTFvec(int j, wavearray<float>& r) {}
102 
103  //: returns size of time-delay filter
104  virtual size_t getTDFsize() { return 0; }
105 
106  //: Allocate data (set pWWS)
107  bool allocate(size_t, DataType_t *);
108 
109  //: return allocate status (true if allocated)
110  bool allocate();
111 
112  //: Release data
113  void release();
114 
115  //: forward wavelet transform
116  virtual void t2w(int=1);
117  //: inverse wavelet transform
118  virtual void w2t(int=1);
119 
120  //: makes one FWT decomposition step
121  virtual void forwardFWT(int, int,
122  const double*,
123  const double*);
124  //: makes one FWT reconstruction step
125  virtual void inverseFWT(int, int,
126  const double*,
127  const double*);
128 
129  //: makes one prediction step for Lifting Wavelet Transform
130  virtual void predict(int,int,const double*);
131  //: makes one update step for Lifting Wavelet Transform
132  virtual void update(int,int,const double*);
133 
134  //: virtual functions for derived wavelet classes
135 
136  //: makes one FWT decomposition step
137  virtual void forward(int,int){}
138  //: makes one FWT reconstruction step
139  virtual void inverse(int,int){}
140 
141  DataType_t *pWWS; //! pointer to wavelet work space
142  unsigned long nWWS; // size of the wavelet work space
143  unsigned long nSTS; // size of the original time series
144 
145  ClassDef(WaveDWT,1)
146 
147 }; // class WaveDWT
148 
149 
150 //}; // namespace wat
151 //}; // namespace datacondAPI
152 
153 #endif // WAVEDWT_HH
154 
TTree * tree
Definition: TimeSortTree.C:20
virtual float getTDamp(int j, int k, char c='p')
Definition: WaveDWT.hh:76
virtual void inverse(int, int)
Definition: WaveDWT.hh:139
BORDER
Definition: Wavelet.hh:36
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
STL namespace.
DataType_t * pWWS
Definition: WaveDWT.hh:141
int j
Definition: cwb_net.C:28
i drho i
virtual void getTFvec(int j, wavearray< float > &r)
Definition: WaveDWT.hh:101
virtual void forward(int, int)
Definition: WaveDWT.hh:137
virtual int getMaxLevel(int i)
Definition: WaveDWT.hh:68
unsigned long nSTS
Definition: WaveDWT.hh:143
virtual WaveDWT< DataType_t > * Init() const
Definition: WaveDWT.hh:64
virtual wavearray< float > getTDvec(int j, int k, char c='p')
Definition: WaveDWT.hh:84
int k
virtual size_t getTDFsize()
Definition: WaveDWT.hh:104
virtual wavearray< float > getTDvecSSE(int j, int k, char c, SSeries< double > *pss)
Definition: WaveDWT.hh:92
regression r
Definition: Regression_H1.C:44
unsigned long nWWS
pointer to wavelet work space
Definition: WaveDWT.hh:142
DataType_t * data
Definition: wavearray.hh:319
virtual int getMaxLevel(int)
Definition: Wavelet.hh:134