3
$\begingroup$

For the inverse continuous wavelet transform, I am using a for-loop which runs through each frequency. At each frequency, I convolve the corresponding morlet wavelet with the signal at that frequency, and add it to my result.

This code is based on the inverse transform outlined in "A Really Friendly Guide to Wavelets" by C. Valens (1999)

for f in range(len(freqs)):
    scale = central_freq / freqs[f]
    wavelet = Chromoscalogram.make_wavelet(quality, central_freq, bandwidth=0.000001, scaling=scale)

    # add convolution of each frequency
    convolved = Chromoscalogram.convolve(data[f], wavelet)
    reconstructed = np.add(Chromoscalogram.deconvolve(convolved, reconstructed)

This usually produces something similar to the original waveform data, but the magnitude is noticeably off by an inconsistent factor (If the frequency of the signal changes over time, then the magnitude will be off by significantly different amounts over time), and the phase is off by pi for certain frequencies

Any help would be appreciated!

$\endgroup$

1 Answer 1

0
$\begingroup$

I don't know the referenced algorithm, but here are some pointers:

  1. This is a "double integral" inverse that uses deconvolution. It is fundamentally limited by boundary effects, i.e. "information scarcity": it cannot recover accurately near boundaries as that's lost to unpadding. The one-integral inverse is almost always superior and doesn't suffer this problem.
  2. I strongly advise against any "discretized" measures. E.g. if we're rescaling by something that depends on bandwidth or center frequency, then compute those directly with discrete formulae. This is likely at the core of the problem you're observing, though it's less of a problem with a sufficient wavelet sampling rate (and what's "sufficient" is tricky).
  3. I implemented both inverses in ssqueezepy. I'm also a hypocrite because I don't follow my advice 2, because I didn't know better at the time and now too busy to fix. (though I did a mix of discrete and discretized)
  4. Regarding phase, if the real or imaginary part in question are very small, that's an inherent limitation of float precision and is to be expected. If not, likely an issue per point 2.
$\endgroup$

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.