astro-informatics / s2wav

Differentiable and accelerated wavelet transform on the sphere with JAX
https://astro-informatics.github.io/s2wav/
MIT License
14 stars 0 forks source link

`filters_axisym` less stable at high `L` than `pys2let.axisym_wav_l` #75

Open paddyroddy opened 1 year ago

paddyroddy commented 1 year ago

Consider the following

import numpy as np
import pys2let
import s2wav

L, j_min, B = 1024, 2, 3
old_kappa = pys2let.axisym_wav_l(B, L, j_min)[1]
new_kappa = s2wav.filter_factory.filters.filters_axisym(L, J_min=j_min, lam=B)[0][j_min:].T
np.testing.assert_equal(old_kappa.shape, new_kappa.shape)
np.testing.assert_equal((old_kappa == np.inf).sum(), 0)
np.testing.assert_equal((new_kappa == np.inf).sum(), 2)  # infinite values

The new method of calculating kappa results in some infinite values, which should be close to 1 or in practical terms equal to 1, and not infinity. This will cause issues when making tiling plots, as scipy.interpolate.pchip cannot handle infinite values, e.g. https://github.com/astro-informatics/sleplet/blob/f61b2af612d0c6a3a462770dbdffb8ba463a3a40/examples/arbitrary/south_america/tiling_south_america.py#L16-L46