Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconstructing details and approximations at all levels with ISWT #600

Open
nsioulas opened this issue Oct 4, 2021 · 6 comments
Open

Reconstructing details and approximations at all levels with ISWT #600

nsioulas opened this issue Oct 4, 2021 · 6 comments
Labels

Comments

@nsioulas
Copy link

nsioulas commented Oct 4, 2021

Hi,

I have been trying to reconstruct the details and approximations at all levels with inverse stationary wavelet transform using the code shown here:

https://stackoverflow.com/questions/69434307/inverse-stationary-wavelet-transform-with-pywavelets

However, it seems to be going wrong. To my understanding there is a way to reconstruct the levels and approximations at all levels for the discrete wavelet transform with pywt.upcoef(...)

Is there an analog for the stationary wavelet transform that I am not aware of?

@nsioulas
Copy link
Author

@rgommers @arfon @nigma @matthew-brett

Hi, I am still struggling t=with this one. Could you provide some insight please? Is there an analog to pywt.upcoef when using ISWT?
Thanks

@grlee77
Copy link
Contributor

grlee77 commented Mar 14, 2022

PyWavelets 1.2 introduced a new set of multiresolution analysis functions. For the 1D case, see pywt.mra. I think that it might do what you want? (pywt.mra docs). If you are familiar with the Matlab Wavelet Toolbox, it is like the function modwtmra there.

The pywt.mra function uses the SWT in a way that provides an additive decomposition such that the original signal is a simple summation of the set of coefficients (you can see here that the inverse transform pywt.imra is just a single line of code that sums all of the coefficients). A beneficial property of this transform is that all of the coefficients will be temporally aligned, which is not the case for the standard SWT (that one is more similar to Matlab's modwt, although likely not identical in implementation).

There is a demo of use with an ECG signal available in this repository.

@grlee77
Copy link
Contributor

grlee77 commented Mar 14, 2022

I should mention that this MRA function internally is using both SWT and ISWT where the ISWT is performed by setting one pair of coefficients to zeros as in the docs linked from your stackoverflow response.

@nsioulas
Copy link
Author

@grlee77 Thank you for your reply! I was trying to get a power spectrum out of the details. However, the spectrum I am getting by applying the code you directed me to, does not seem to match the Fourier power spectrum of my time-series. Any idea why?

@nsioulas
Copy link
Author

@grlee77 I guess this is because I am trying to estimate the power spectrum using the details in the real physical space. Is there any chance I could doobtain the coefficients of the details? Thanks!

@davidrodord56
Copy link

If i understand clearly pywt.mra returns the Wavelet subspaces of a signal, preserving it length, and using the SWT.

The result is similar to modwtmra from matlab, but of course not similar to modwt, right?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants