Pad to bring the total length N up to the next-higher power of two.
Parameters : |
|
---|---|
Returns : |
|
Discrete Wavelet Transform based on the GSL DWT [Gsldwt].
For the forward transform, the output is the discrete wavelet transform in a packed triangular storage layout, where is the index of the level and is the index of the coefficient within each level, . The total number of levels is . The output data has the following form,
where the first element is the smoothing coefficient , followed by the detail coefficients for each level . The backward transform inverts these coefficients to obtain the original data.
Note
from GSL online manual (http://www.gnu.org/software/gsl/manual/)
Discrete Wavelet Tranform
Parameters : |
|
---|---|
Returns : |
|
Example
>>> import numpy as np
>>> import mlpy.wavelet as wave
>>> x = np.array([1,2,3,4,3,2,1,0])
>>> wave.dwt(x=x, wf='d', k=6)
array([ 5.65685425, 3.41458985, 0.29185347, -0.29185347, -0.28310081,
-0.07045258, 0.28310081, 0.07045258])
Inverse Discrete Wavelet Tranform
Parameters : |
|
---|---|
Returns : |
|
Example:
>>> import numpy as np
>>> import mlpy.wavelet as wave
>>> X = np.array([ 5.65685425, 3.41458985, 0.29185347, -0.29185347, -0.28310081,
... -0.07045258, 0.28310081, 0.07045258])
>>> wave.idwt(X=X, wf='d', k=6)
array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00,
4.00000000e+00, 3.00000000e+00, 2.00000000e+00,
1.00000000e+00, -3.53954610e-09])
Undecimated Wavelet Transform (also known as stationary wavelet transform, redundant wavelet transform, translation invariant wavelet transform, shift invariant wavelet transform or Maximal overlap wavelet transform) based on the “wavelets” R package.
Undecimated Wavelet Tranform
Parameters : |
|
---|---|
Returns : |
|
Inverse Undecimated Wavelet Tranform
Parameters : |
|
---|---|
Returns : |
|
UWT h2 coefficients aligment.
If inverse = True performs the misalignment for a correct reconstruction.
UWT d4 coefficients aligment.
If inverse = True performs the misalignment for a correct reconstruction.
Continuous Wavelet Transform based on [Torrence98].
Continuous Wavelet Tranform.
Parameters : |
|
---|---|
Returns : |
|
Inverse Continuous Wavelet Tranform. The reconstruction factor is not applied.
Parameters : |
|
---|---|
Returns : |
|
Compute scales as fractional power of two.
Parameters : |
|
---|---|
Returns : |
|
Compute the equivalent fourier period from scales.
Parameters : |
|
---|---|
Returns : | fourier wavelengths |
Compute scales from fourier period.
Parameters : |
|
---|---|
Returns : | scales |
[Torrence98] | C Torrence and G P Compo. Practical Guide to Wavelet Analysis |
[Gsldwt] | Gnu Scientific Library, http://www.gnu.org/software/gsl/ |
Example (requires matplotlib)
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import mlpy.wavelet as wave
>>> x = np.random.sample(512)
>>> scales = wave.autoscales(N=x.shape[0], dt=1, dj=0.25, wf='dog', p=2)
>>> X = wave.cwt(x=x, dt=1, scales=scales, wf='dog', p=2)
>>> fig = plt.figure(1)
>>> ax1 = plt.subplot(2,1,1)
>>> p1 = ax1.plot(x)
>>> ax1.autoscale_view(tight=True)
>>> ax2 = plt.subplot(2,1,2)
>>> p2 = ax2.imshow(np.abs(X), interpolation='nearest')
>>> plt.show()