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

inconsistent wavelet coefficients #327

Closed
macelee opened this issue Oct 20, 2017 · 4 comments
Closed

inconsistent wavelet coefficients #327

macelee opened this issue Oct 20, 2017 · 4 comments

Comments

@macelee
Copy link

macelee commented Oct 20, 2017

I find that the wavelet coefficients as shown in the Wavelet Browser website are not exactly the same as those in pywt module.

For example from http://wavelets.pybytes.com/, if I select "Coiflets 1", then click 'Copy' next to the decomposition low-pass filter link, I get the following values:

-0.01565572813546454
-0.0727326195128539
0.38486484686420286
0.8525720202122554
0.3378976624578092
-0.0727326195128539

If I inspect these values using Python, I have slightly different values:

import pywt
print pywt.version
0.5.2
w=pywt.Wavelet('coif1')
w.dec_lo
[-0.015655728135791993, -0.07273261951252645, 0.3848648468648578, 0.8525720202116004, 0.3378976624574818, -0.07273261951252645]

As can be seen these values only roughly match to 11 or 12 digits.

In some other cases, the differences are much larger. For example, for the 30th coefficients of the low-pass filter for decomposition, we have -0.00021208083980379827 vs -0.000212081862067494 (different at the 6th non-zero digit).

The difference is very large. After the wavelet transform I sometimes get bigger differences that cannot be ignored.

I wonder which set of data is more accurate and why there is this discrepancy.

@grlee77
Copy link
Contributor

grlee77 commented Oct 20, 2017

The values are indeed a bit inconsistent because the http://wavelets.pybytes.com site is outdated. It was created by the original author of this package and is no longer actively maintained. Debauchies and Coiflet coefficients with extended precision were added 1-2 years ago in PR #164. See specifically the discussion in that PR and the reference highlighted here:
https://github.com/PyWavelets/pywt/blame/52b1808c2353f1b78433e03e36301b63d3037749/pywt/_extensions/c/wavelets_coeffs.template.h#L18-L32

@macelee
Copy link
Author

macelee commented Oct 21, 2017

Thanks for your information. I am processing the "wavelets_coeffs.template" file using a script. Line 2131 of that file contains one extra comma in the end. Is that a problem?

@grlee77
Copy link
Contributor

grlee77 commented Jul 5, 2018

I am processing the "wavelets_coeffs.template" file using a script. Line 2131 of that file contains one extra comma in the end. Is that a problem?

C is okay with trailing commas, but we could perhaps remove it for stylistic consistency with the other cases.

@rgommers
Copy link
Member

Fixed in gh-413 by adding a disclaimer to the docs.

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

No branches or pull requests

3 participants