Closed flying-gwx closed 1 year ago
@CosmoMatt @alicjapolanska @JessWhitney Could someone please get back to @flying-gwx about this?
Hi @flying-gwx, I think this is a little oversight on our behalf (this code is still under development). Basically this line in the docstrings indicates that filters is an optional argument. This was our intention as, if the user doesn't provide custom filters then a simple statement will catch that no filters have been provided and we will construct some default.
However, we have not yet implemented JAX functions to generate the filters, so when no filters are provided the code ends up trying to convolve your signal with none (!). For the time being you'll want to run something like this
import s2wav
import numpy as np
L = 128
N = 1
f = np.ones((L, 2*L-1))
filter = filters.filters_directional_vectorised(L, N)
f_wav, f_scal = s2wav.analysis(f, L, N, filters=filter)
f = s2wav.synthesis(f_wav, f_scal, L, N)
which should work I think. When I get a chance I'll add a Warning for this, and we'll try and add a catch to automatically generate the filters where needed.
Sorry for any confusion here!
Thanks for your reply. I had tested the script and it worked. By the way, Here is the code(with a little difference).
import s2wav
import numpy as np
import s2wav.filter_factory.filters as filters
L = 128
N = 1
f = np.ones((L, 2*L-1))
# Compute wavelet coefficients
filter = filters.filters_directional_vectorised(L, N)
f_wav, f_scal = s2wav.analysis(f, L, N, filters=filter, reality=True)
# Map back to signal on the sphere
f_build = s2wav.synthesis(f_wav, f_scal, L, N, filters=filter, reality=True)
print(np.abs(f_build -f).mean())
Thanks @flying-gwx, I'll open a separate issue for automatic filter computation now. If you run into any further definitely let the team know!
Hello,
I want to try the s2wav lib according to https://github.com/astro-informatics/s2let/issues/50#issuecomment-1553105667. When I try the code demo, I found an error occurs in s2wav/transforms/jax_wavelets.py", line 260. It seams like that the
filters
is needful to perform wavelet transform(but it should be optional ). Did I do anything wrong?Here is my test code:
Here is the error:
I have used the
pytest
to tests2wav
and I pass the test.Thanks.