# Signal Reconstruction Using Scipy.signal.cwt

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.

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

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