s2ball is currently in an open alpha, please provide feedback on GitHub

Ball wavelet#

s2ball.transform.ball_wavelet.forward(f: ndarray, L: int, N: int, P: int, matrices: List[ndarray] | None = None, lam_l: float = 2.0, lam_p: float = 2.0, tau: float = 1.0, method: str = 'jax', save_dir: str = '.matrices', adjoint: bool = False) Tuple[List[List[ndarray]], ndarray]#

Compute the forward directional wavelet transform on the ball.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • f (np.ndarray) – Signal on the ball, with shape [P, L, 2L-1].

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • tau (float) – Laguerre polynomial scale factor.

  • matrices (List[np.ndarray], optional) – List of matrices corresponding to all necessary precomputed values. Defaults to None.

  • method (str, optional) – Evaluation method in {“numpy”, “jax”}. Defaults to “jax”.

  • save_dir (str, optional) – Directory in which to save precomputed matrices. Defaults to “.matrices”.

  • adjoint (bool, optional) – Whether to return adjoint transformation. Defaults to False.

Raises:

ValueError – Method not in {“numpy”, “jax”}.

Returns:

Multiresolution scaling and wavelet coefficients

Return type:

List[np.ndarray, List[List[np.ndarray]]]

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.

s2ball.transform.ball_wavelet.forward_transform(f: ndarray, L: int, N: int, P: int, matrices: List[ndarray], lam_l: float = 2.0, lam_p: float = 2.0, shift: int = 0) Tuple[ndarray, List[List[ndarray]]]#

Compute the forward directional wavelet transform on the ball with Numpy.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • f (np.ndarray) – Signal on the ball, with shape [P, L, 2L-1].

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • matrices (List[np.ndarray]) – List of matrices corresponding to all necessary precomputed values.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • shift (int, optional) – Shift for multiscale reindexing for adjoint transforms.

Returns:

Multiresolution scaling and wavelet coefficients

Return type:

List[np.ndarray, List[List[np.ndarray]]]

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.

s2ball.transform.ball_wavelet.forward_transform_jax(f: Array, L: int, N: int, P: int, matrices: List[Array], lam_l: float = 2.0, lam_p: float = 2.0, shift: int = 0) Tuple[Array, Array, List[List[ndarray]]]#

Compute the forward directional wavelet transform on the ball with JAX and JIT.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • f (jnp.ndarray) – Signal on the ball, with shape [P, L, 2L-1].

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • matrices (List[np.ndarray]) – List of matrices corresponding to all necessary precomputed values.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • shift (int, optional) – Shift for multiscale reindexing for adjoint transforms.

Returns:

Multiresolution scaling and wavelet coefficients

Return type:

List[jnp.ndarray, List[List[jnp.ndarray]]]

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.

s2ball.transform.ball_wavelet.inverse(w: Tuple[ndarray, List[List[ndarray]]], L: int, N: int, P: int, matrices: List[ndarray] | None = None, lam_l: float = 2.0, lam_p: float = 2.0, tau: float = 1.0, method: str = 'jax', save_dir: str = '.matrices', adjoint: bool = False) ndarray#

Compute the inverse directional wavelet transform on the ball.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • w (Tuple[np.ndarray, List[List[np.ndarray]]]) – List containing scaling and wavelet coefficients in that order.

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • tau (float) – Laguerre polynomial scale factor.

  • matrices (List[np.ndarray], optional) – List of matrices corresponding to all necessary precomputed values. Defaults to None.

  • method (str, optional) – Evaluation method in {“numpy”, “jax”}. Defaults to “jax”.

  • save_dir (str, optional) – Directory in which to save precomputed matrices. Defaults to “.matrices”.

  • adjoint (bool, optional) – Whether to return adjoint transformation. Defaults to False.

Raises:

ValueError – Method not in {“numpy”, “jax”}.

Returns:

Signal on the ball, with shape [P, L, 2L-1].

Return type:

np.ndarray

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.

s2ball.transform.ball_wavelet.inverse_transform(w: Tuple[ndarray, List[List[ndarray]]], L: int, N: int, P: int, matrices: List[ndarray], lam_l: float = 2.0, lam_p: float = 2.0, shift: int = 0) ndarray#

Compute the inverse directional wavelet transform on the ball with Numpy.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • w (Tuple[np.ndarray, List[List[np.ndarray]]]) – List containing scaling and wavelet coefficients in that order.

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • matrices (List[np.ndarray]) – List of matrices corresponding to all necessary precomputed values.

  • shift (int, optional) – Shift for multiscale reindexing for adjoint transforms.

Returns:

Signal on the ball, with shape [P, L, 2L-1].

Return type:

np.ndarray

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.

s2ball.transform.ball_wavelet.inverse_transform_jax(w: Tuple[ndarray, List[List[ndarray]]], L: int, N: int, P: int, matrices: List[Array], lam_l: float = 2.0, lam_p: float = 2.0, shift: int = 0) Array#

Compute the inverse directional wavelet transform on the ball with JAX and JIT.

This transform does not yet support batching, though this is straightforward to add.

Parameters:
  • w (Tuple[np.ndarray, List[List[np.ndarray]]]) – List containing scaling and wavelet coefficients in that order.

  • L (int) – Harmonic band-limit.

  • N (int) – Directional band-limit. Must be < L.

  • P (int) – Radial band-limit.

  • lam_l (float, optional) – Wavelet angular scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • lam_p (float, optional) – Wavelet radial scaling factor. \(\lambda = 2.0\) indicates dyadic wavelets. Defaults to 2.0.

  • matrices (List[np.ndarray]) – List of matrices corresponding to all necessary precomputed values.

  • shift (int, optional) – Shift for multiscale reindexing for adjoint transforms.

Returns:

Signal on the ball, with shape [P, L, 2L-1].

Return type:

jnp.ndarray

Note

Currently only Leistedt & McEwen sampling on the ball is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix+. Also see Price & McEwen for details on directionality.