A few functions (i.e. wavelet transforms) are provided for data preprocessing purposes.
Discrete Wavelet Transform based on the GSL DWT [Gsldwt].
Discrete Wavelet Tranform
Input
- x - [1D numpy array float] data
- wf - [string] wavelet type (‘d’: daubechies, ‘h’: haar, ‘b’: bspline)
- k - [integer] member of the wavelet family
- daubechies: k = 4, 6, ..., 20 with k even
- haar: the only valid choice of k is k = 2
- bspline: k = 103, 105, 202, 204, 206, 208, 301, 303, 305 307, 309
Output
- X - [1D numpy array float] discrete wavelet transform
Inverse Discrete Wavelet Tranform
Input
- X - [1D numpy array float] data
- wf - [string] wavelet type (‘d’: daubechies, ‘h’: haar, ‘b’: bspline)
- k - [integer] member of the wavelet family
- daubechies: k = 4, 6, ..., 20 with k even
- haar: the only valid choice of k is k = 2
- bspline: k = 103, 105, 202, 204, 206, 208, 301, 303, 305 307, 309
Output
- x - [1D numpy array float]
Continuous Wavelet Transform based on [Torrence98].
Continuous Wavelet Tranform.
Input
- x - [1D numpy array float] data
- dt - [float] time step
- dj - [float] scale resolution (smaller values of dt give finer resolution)
- wf - [string] wavelet function (‘morlet’, ‘paul’, ‘dog’)
- p - [float] wavelet function parameter
- pad - [float] minimum fraction of added zeros (zero padding)
Output
- X, scales - (scales x angularfreq) [2D numpy array complex], scales [1D numpy array float]
Inverse Continuous Wavelet Tranform.
Input
X - (scales x angularfreq) [2D numpy array complex]
dt - [float] time step
dj - [float] scale resolution (smaller values of dt give finer resolution)
wf - [string] wavelet function (‘morlet’, ‘paul’, ‘dog’)
p - [int] wavelet function parameter
- morlet: 2, 4, 6
- paul: 2, 4, 6
- dog: 2, 6, 10
recf - [bool] use the reconstruction factor (Cdelta*psi_0(0))
Output
- x - [1D numpy array float]
See [Torrence98].
Compute angular frequencies.
Input
- N - [integer] number of data samples
- dt - [float] time step
Output
- angular frequencies - [1D numpy array float]
Compute scales.
Input
- N - [integer] number of data samples
- dj - [float] scale resolution
- dt - [float] time step
Output
- scales - [1D numpy array float]
Compute s0.
Input
- dt - [float] time step
- p - [float] omega0 (‘morlet’) or order (‘paul’, ‘dog’)
- wf - [string] wavelet function (‘morlet’, ‘paul’, ‘dog’)
Output
- s0 - [float]
[Torrence98] | (1, 2) C Torrence and G P Compo. Practical Guide to Wavelet Analysis |
[Gsldwt] | Gnu Scientific Library, http://www.gnu.org/software/gsl/ |