s2wav is currently in an open beta, please provide feedback on GitHub

Numpy Transforms#

s2wav.transforms.base.analysis(f: ndarray, L: int, N: int = 1, J_min: int = 0, lam: float = 2.0, spin: int = 0, spin0: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, multiresolution: bool = True, scattering: bool = False) Tuple[ndarray, ndarray]#

Wavelet analysis from pixel space to wavelet space for complex signals.

Parameters:
  • f (np.ndarray) – Signal \(f\) on the sphere with shape \([n_{\theta}, n_{\phi}]\).

  • L (int) – Harmonic bandlimit.

  • N (int, optional) – Upper azimuthal band-limit. Defaults to 1.

  • J_min (int, optional) – Lowest frequency wavelet scale to be used. Defaults to 0.

  • lam (float, optional) – Wavelet parameter which determines the scale factor between consecutive wavelet scales. Note that \(\lambda = 2\) indicates dyadic wavelets. Defaults to 2.

  • spin (int, optional) – Spin (integer) of input signal. Defaults to 0.

  • spin0 (int, optional) – Spin (integer) of output signal. Defaults to 0.

  • sampling (str, optional) – Spherical sampling scheme from {“mw”,”mwss”, “dh”, “healpix”}. Defaults to “mw”.

  • nside (int, optional) – HEALPix Nside resolution parameter. Only required if sampling=”healpix”. Defaults to None.

  • reality (bool, optional) – Whether \(f \in \mathbb{R}\), if True exploits conjugate symmetry of harmonic coefficients. Defaults to False.

  • multiresolution (bool, optional) – Whether to store the scales at \(j_{\text{max}}\) resolution or its own resolution. Defaults to True.

  • scattering (bool, optional) – If using for scattering transform return absolute value of scattering coefficients.

Returns:

Array of wavelet pixel-space coefficients

with shape \([n_{J}, 2N-1, n_{\theta}, n_{\phi}]\).

f_scal (np.ndarray): Array of scaling pixel-space coefficients

with shape \([n_{\theta}, n_{\phi}]\).

Return type:

f_wav (np.ndarray)

s2wav.transforms.base.analysis_looped(f: ndarray, L: int, N: int = 1, J_min: int = 0, lam: float = 2.0, spin: int = 0, spin0: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, multiresolution: bool = True) Tuple[ndarray, ndarray]#

Wavelet analysis from pixel space to wavelet space for complex signals.

Parameters:
  • f (np.ndarray) – Signal \(f\) on the sphere with shape \([n_{\theta}, n_{\phi}]\).

  • L (int) – Harmonic bandlimit.

  • N (int, optional) – Upper azimuthal band-limit. Defaults to 1.

  • J_min (int, optional) – Lowest frequency wavelet scale to be used. Defaults to 0.

  • lam (float, optional) – Wavelet parameter which determines the scale factor between consecutive wavelet scales. Note that \(\lambda = 2\) indicates dyadic wavelets. Defaults to 2.

  • spin (int, optional) – Spin (integer) of input signal. Defaults to 0.

  • spin0 (int, optional) – Spin (integer) of output signal. Defaults to 0.

  • sampling (str, optional) – Spherical sampling scheme from {“mw”,”mwss”, “dh”, “healpix”}. Defaults to “mw”.

  • nside (int, optional) – HEALPix Nside resolution parameter. Only required if sampling=”healpix”. Defaults to None.

  • reality (bool, optional) – Whether \(f \in \mathbb{R}\), if True exploits conjugate symmetry of harmonic coefficients. Defaults to False.

  • multiresolution (bool, optional) – Whether to store the scales at \(j_{\text{max}}\) resolution or its own resolution. Defaults to True.

Returns:

Array of wavelet pixel-space coefficients

with shape \([n_{J}, 2N-1, n_{\theta}, n_{\phi}]\).

f_scal (np.ndarray): Array of scaling pixel-space coefficients

with shape \([n_{\theta}, n_{\phi}]\).

Return type:

f_wav (np.ndarray)

s2wav.transforms.base.synthesis(f_wav: ndarray, f_scal: ndarray, L: int, N: int = 1, J_min: int = 0, lam: float = 2.0, spin: int = 0, spin0: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, multiresolution: bool = True) ndarray#

Computes the synthesis directional wavelet transform [1,2]. Specifically, this transform synthesises the signal \(_{s}f(\omega) \in \mathbb{S}^2\) by summing the contributions from wavelet and scaling coefficients in harmonic space, see equation 27 from [2]. :param f_wav: Array of wavelet pixel-space coefficients

with shape \([n_{J}, 2N-1, n_{\theta}, n_{\phi}]\).

Parameters:
  • f_scal (np.ndarray) – Array of scaling pixel-space coefficients with shape \([n_{\theta}, n_{\phi}]\).

  • L (int) – Harmonic bandlimit.

  • N (int, optional) – Upper azimuthal band-limit. Defaults to 1.

  • J_min (int, optional) – Lowest frequency wavelet scale to be used. Defaults to 0.

  • lam (float, optional) – Wavelet parameter which determines the scale factor between consecutive wavelet scales. Note that \(\lambda = 2\) indicates dyadic wavelets. Defaults to 2.

  • spin (int, optional) – Spin (integer) of input signal. Defaults to 0.

  • spin0 (int, optional) – Spin (integer) of output signal. Defaults to 0.

  • sampling (str, optional) – Spherical sampling scheme from {“mw”,”mwss”, “dh”, “healpix”}. Defaults to “mw”.

  • nside (int, optional) – HEALPix Nside resolution parameter. Only required if sampling=”healpix”. Defaults to None.

  • reality (bool, optional) – Whether \(f \in \mathbb{R}\), if True exploits conjugate symmetry of harmonic coefficients. Defaults to False.

  • multiresolution (bool, optional) – Whether to store the scales at \(j_{\text{max}}\) resolution or its own resolution. Defaults to True.

Raises:

AssertionError – Shape of wavelet/scaling coefficients incorrect.

Returns:

Signal \(f\) on the sphere with shape \([n_{\theta}, n_{\phi}]\).

Return type:

np.ndarray

Notes

[1] B. Leidstedt et. al., “S2LET: A code to perform fast wavelet analysis on the sphere”, A&A, vol. 558, p. A128, 2013. [2] J. McEwen et. al., “Directional spin wavelets on the sphere”, arXiv preprint arXiv:1509.06749 (2015).

s2wav.transforms.base.synthesis_looped(f_wav: ndarray, f_scal: ndarray, L: int, N: int, J_min: int = 0, lam: float = 2.0, spin: int = 0, spin0: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, multiresolution: bool = True) ndarray#

Computes the synthesis directional wavelet transform [1,2]. Specifically, this transform synthesises the signal \(_{s}f(\omega) \in \mathbb{S}^2\) by summing the contributions from wavelet and scaling coefficients in harmonic space, see equation 27 from [2]. :param f_wav: Array of wavelet pixel-space coefficients

with shape \([n_{J}, 2N-1, n_{\theta}, n_{\phi}]\).

Parameters:
  • f_scal (np.ndarray) – Array of scaling pixel-space coefficients with shape \([n_{\theta}, n_{\phi}]\).

  • L (int) – Harmonic bandlimit.

  • N (int, optional) – Upper azimuthal band-limit. Defaults to 1.

  • J_min (int, optional) – Lowest frequency wavelet scale to be used. Defaults to 0.

  • lam (float, optional) – Wavelet parameter which determines the scale factor between consecutive wavelet scales. Note that \(\lambda = 2\) indicates dyadic wavelets. Defaults to 2.

  • spin (int, optional) – Spin (integer) of input signal. Defaults to 0.

  • spin0 (int, optional) – Spin (integer) of output signal. Defaults to 0.

  • sampling (str, optional) – Spherical sampling scheme from {“mw”,”mwss”, “dh”, “healpix”}. Defaults to “mw”.

  • nside (int, optional) – HEALPix Nside resolution parameter. Only required if sampling=”healpix”. Defaults to None.

  • reality (bool, optional) – Whether \(f \in \mathbb{R}\), if True exploits conjugate symmetry of harmonic coefficients. Defaults to False.

  • multiresolution (bool, optional) – Whether to store the scales at \(j_{\text{max}}\) resolution or its own resolution. Defaults to True.

Raises:

AssertionError – Shape of wavelet/scaling coefficients incorrect.

Returns:

Signal \(f\) on the sphere with shape \([n_{\theta}, n_{\phi}]\).

Return type:

np.ndarray

Notes

[1] B. Leidstedt et. al., “S2LET: A code to perform fast wavelet analysis on the sphere”, A&A, vol. 558, p. A128, 2013. [2] J. McEwen et. al., “Directional spin wavelets on the sphere”, arXiv preprint arXiv:1509.06749 (2015).