Hi there,
The cwt() code currently use a discrete convolution algorithm which is ~O( len(data) * scale).
While this is usually fine for common values of data and scale < 100, it becomes an issue quickly for EEG like signals with 100k samples or sound.
To overcome this limit I implemented a selective algorithm which switch to
~O( len(data) * log(len(data)) with a FFT based convolution when its complexity is lower.
I propose to merge this version with the pywt tree if you guys find it appropriate.
The source code has been implemented as a drop-in replacement to the function cwt() and is available on the scaleogram project as fastcwt() in this file.
The output has been unit tested with all continuous wavelet to be the same as the current pywt.cwt() output at floating point precision level, which is expected from FFT based convolution when circular convolution is avoided.
Example::
%time (coef1, freq1) = fastcwt(np.arange(140000), np.arange(2,200), 'cmorl1-1')
=> CPU times: user 12.6 s, sys: 2.2 s, total: 14.8 s
=> Wall time: 14.9 s
%time (coef1, freq1) = pywt.cwt(np.arange(140000), np.arange(2,200), 'cmorl1-1')
=> CPU times: user 1min 50s, sys: 401 ms, total: 1min 51s
=> Wall time: 1min 51s
This file is part of a a visualization tool designed for wavelet beginners and is wrapped around PyWavelets.
Hi there,
The cwt() code currently use a discrete convolution algorithm which is
~O( len(data) * scale).While this is usually fine for common values of data and scale < 100, it becomes an issue quickly for EEG like signals with 100k samples or sound.
To overcome this limit I implemented a selective algorithm which switch to
~O( len(data) * log(len(data))with a FFT based convolution when its complexity is lower.I propose to merge this version with the pywt tree if you guys find it appropriate.
The source code has been implemented as a drop-in replacement to the function cwt() and is available on the
scaleogramproject asfastcwt()in this file.The output has been unit tested with all continuous wavelet to be the same as the current pywt.cwt() output at floating point precision level, which is expected from FFT based convolution when circular convolution is avoided.
Example::
This file is part of a a visualization tool designed for wavelet beginners and is wrapped around PyWavelets.