I'm just learning about wavelets and the PyWavelets package. I saw a reference to MODWT, which led me to the SO post here and then to this Python package: https://github.com/pistonly/modwtpy

What seems to be unique about the modwt and modwtmra functions (compared to anything I'm seeing in PyWavelets) is that their outputs can be summed across the zero axis to reconstruct the original series.

Here's an example:

import numpy as np
import modwt
x = np.arange(8).astype(float) # array([0., 1., 2., 3., 4., 5., 6., 7.])
wavelet = "db2"
wt = modwt.modwt(x, wavelet, level=3)
wtmra = modwt.modwtmra(wt, wavelet)
x_recon = wtmra.sum(axis=0).round(5) # arbitrary rounding to ensure precision of assert
assert (x == x_recon).all()

If I understand correctly, an advantage of this is that the outputs of modwtmra can be used for regression purposes. That is, the individual output series can be used as model inputs and then the outputs of each model (one for each series) can be summed to make a prediction on the original series.

I see in the PyWavelets documentation that the Stationary Wavelet Transform is similar to MODWT if norm=True, however, I'm not sure if it's possible to get the same kind of additive output.

So what I'm wondering is:

  1. If my understanding about using the outputs from MODWT/MODWTMRA for regression is correct. If so, could someone explain how exactly this works? What are these transforms doing that allows the wavelet properties to be maintained while still allowing for regression?
  2. Is it possible to replicate the additive output using SWT in PyWavelets? If not, what is the difference between what SWT is doing in PyWavelets and what's happening with MODWT/MODWTMRA?
  • 1
    $\begingroup$ The CWT also permits reconstruction via sum(axis=0), better implemented in ssqueezepy, and explained here. Am unfamiliar with modwtmra. $\endgroup$ Mar 29, 2021 at 5:50
  • $\begingroup$ Interesting stuff. I'll have to take a further look at it. $\endgroup$ Mar 29, 2021 at 16:56

1 Answer 1


The answer to your question can be found here :



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.