The Fast Wavelet Transform is a mathematical algorithm designed to turn a waveform or signal in the time domain into a sequence of coefficients based on an orthogonal basis of small finite waves, or wavelets.
Here is FWT for 1D array using Haar method.
Transform class for this task:
from math.jwave import Transform from math.jwave.transforms import * from math.jwave.transforms.wavelets import * t=Transform( FastWaveletTransform( Haar02( ) )) arrTime = [1, 10, 12, 8, 1, 1, 1, 1. ] arrFreq = t.forward( arrTime ) # 1-D FWT Haar forward print arrFreq.tolist() arrReco = t.reverse( arrFreq ) # 1-D FWT Haar reverse print arrReco.tolist()
The output of this code is:
[12.374368670764577, 9.545941546018389, -4.499, 0.0, -6.363, 2.8284, 0.0, 0.0] [1, 10, 12, 8, 1, 1, 1, 1. ]
Now let us consider a FWT transformation of 2D array. This is an extension of the above script: