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

Feature Request: Symlet16 #1

Open
M-Colley opened this issue Dec 16, 2024 · 10 comments
Open

Feature Request: Symlet16 #1

M-Colley opened this issue Dec 16, 2024 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@M-Colley
Copy link

Hey there, thank you for your nice package!

I was wondering whether you could also implement the symlet16 version?

That would be really helpful for me.

Kind regards

@graetz23
Copy link
Owner

Hi there,

many thanks, you are welcome.

Sure, do you have the coefficients or a function / formula to great those?

best
Chris

@M-Colley
Copy link
Author

This is the most challenging part - I have failed to find that. Where did you find the coefficients for the previous ones?

Maybe I can renew my search from there.

Kind regards

@M-Colley
Copy link
Author

I did find these: https://www.continuummechanics.org/wavedaubcoefs.html

However, I am not sure whether they are adequate.

@M-Colley
Copy link
Author

Maybe these are actually correct?

https://github.com/PyWavelets/pywt/blob/cf622996f3f0dedde214ab696afcd024660826dc/pywt/_extensions/c/wavelets_coeffs.template.h#L1677

static const TYPE CAT(sym16_, TYPE)[32] = {
-1.0797982104319795e-005, -5.3964831793152419e-006, 0.00016545679579108483, 3.656592483348223e-005, -0.0013387206066921965, -0.00022211647621176323, 0.0069377611308027096, 0.001359844742484172, -0.024952758046290123, -0.0035102750683740089, 0.078037852903419913, 0.03072113906330156, -0.15959219218520598, -0.054040601387606135, 0.47534280601152273, 0.75652498787569711, 0.39712293362064416, -0.034574228416972504, -0.066983049070217779, 0.032333091610663785, 0.0048692744049046071, -0.031051202843553064, -0.0031265171722710075, 0.012666731659857348, 0.00071821197883178923, -0.0038809122526038786, -0.0001084456223089688, 0.00085235471080470952, 2.8078582128442894e-005, -0.00010943147929529757, -3.1135564076219692e-006, 6.2300067012207606e-006
};

If so, it might be great to add the additional symlets that are currently missing as well?

Kind regards

@graetz23
Copy link
Owner

Hi,

sorry for the delay, the holidays are busy :-)

I can give those a try, let me check, hope it's ok by some days?

best
Christian

@M-Colley
Copy link
Author

Hi, no worries at all - I am very grateful for that - happy holidays :)

Kind regards
Mark

@graetz23
Copy link
Owner

@M-Colley I have added it by copying your supported coefficients from pywavelets ..

I quickly make an executable project in a sub folder and have that in an extra branch for teting the precision. However, you can give it already a try :-)

Merry Christmas
Christian

@graetz23
Copy link
Owner

Hi Mark,

the rounding error is smaller than: 1e-14, so the Symlet16 works fine by the methods of Main.

Let me know if it works for you too.

best & a merry Christmas
Christian

@graetz23 graetz23 self-assigned this Dec 29, 2024
@graetz23 graetz23 added the enhancement New feature or request label Dec 29, 2024
@FabianFi
Copy link

Hey Christian,

thanks for the quick update in December.

I'm a colleague of Mark and have already tested the Symlet16 implementation.

So far we have only worked with wavelets in Python and now want to develop a project in C# and we noticed something strange:
While the low-pass coefficients mentioned above and now implemented in SharpWave are also in the PyWavelets documentation (link above), they differ from the low-pass coefficients actually used in Python PyWavelets (by reading the coefficients with pywt.Wavelet('sym16').dec_lo or pywt.Wavelet('sym16').dec_hi}) in the following way:

LowPass Coefficients = [6.230006701220761e-06, -3.113556407621969e-06, -0.00010943147929529757, 2.8078582128442894e-05, 0.0008523547108047095, -0.0001084456223089688, -0.0038809122526038786, 0.0007182119788317892, 0.012666731659857348, -0.0031265171722710075, -0.031051202843553064, 0.004869274404904607, 0.032333091610663785, -0.06698304907021778, -0.034574228416972504, 0.39712293362064416, 0.7565249878756971, 0.47534280601152273, -0.054040601387606135, -0.15959219218520598, 0.03072113906330156, 0.07803785290341991, -0.003510275068374009, -0.024952758046290123, 0.001359844742484172, 0.0069377611308027096, -0.00022211647621176323, -0.0013387206066921965, 3.656592483348223e-05, 0.00016545679579108483, -5.396483179315242e-06, -1.0797982104319795e-05]

HighPass Coefficients = [1.0797982104319795e-05, -5.396483179315242e-06, -0.00016545679579108483, 3.656592483348223e-05, 0.0013387206066921965, -0.00022211647621176323, -0.0069377611308027096, 0.001359844742484172, 0.024952758046290123, -0.003510275068374009, -0.07803785290341991, 0.03072113906330156, 0.15959219218520598, -0.054040601387606135, -0.47534280601152273, 0.7565249878756971, -0.39712293362064416, -0.034574228416972504, 0.06698304907021778, 0.032333091610663785, -0.004869274404904607, -0.031051202843553064, 0.0031265171722710075, 0.012666731659857348, -0.0007182119788317892, -0.0038809122526038786, 0.0001084456223089688, 0.0008523547108047095, -2.8078582128442894e-05, -0.00010943147929529757, 3.113556407621969e-06, 6.230006701220761e-06]

The low-pass coefficients given in the documentation seem to be a mirror image of the low-pass coefficients or an orthogonal shift of the high-pass coefficients.

Under these conditions, would the coefficients of the new Symlet16 implementation need to be updated again?

Kind regards
Fabian

@graetz23
Copy link
Owner

graetz23 commented Jan 23, 2025

Hi Fabian,

thanks for noticing - thought the issue got cold.

That could be both the case! But it should not lead to any other performance while you are working with several orthogonal sets that are just differently combined.

I tried to joke that on the main read me of the java version.

If you could give the c# a try and compare the results - what ever use case you have - it would likely that you receive the same performance; comparing not value to value, for example compression rate or denoising ratio.

Best
Christian

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

No branches or pull requests

3 participants