0
$\begingroup$

Can someone explain to me how I can reconstruct a signal using the scipy.signal.morlet2?

The codes in the link only allows one to do a fourier transform using the morlet wavelet, but there is no such code for inverse fourier transforms (reconstructing my transformed signal).

Any help would be gratefully received.

Thanks in advance.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.morlet2.html

$\endgroup$

1 Answer 1

2
$\begingroup$

For arbitrary, non-zero phase wavelet (the case with scipy) inversion, you'll need to implement deconvolution, which will be error prone (especially in scipy). Scipy has no built-in CWT inversion, and its CWT is flawed.

You can do correct forward and inverse CWT using ssqueezepy:

import numpy as np
from ssqueezepy import Wavelet, cwt, icwt

np.random.seed(0)
x = np.random.randn(2048)
wavelet = Wavelet('morlet')

Wx, scales = cwt(x, wavelet)
xrec = icwt(Wx, wavelet, scales)

print("Mean Squared Error: %.3g" % np.mean(np.abs(x - xrec)**2))
Mean Squared Error: 0.000994
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.