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

PyTorch Transforms (Precompute)#

s2wav.transforms.wavelet_precompute_torch.analysis(f: tensor, L: int, N: int = 1, J_min: int = 0, lam: float = 2.0, spin: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, filters: Tuple[tensor] | None = None, precomps: List[List[tensor]] | None = None) Tuple[tensor]#

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

Parameters:
  • f (torch.tensor) – 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.

  • 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.

  • filters (Tuple[torch.tensor], optional) – Precomputed wavelet filters. Defaults to None.

  • precomps (List[torch.tensor]) – Precomputed list of recursion coefficients. At most of length \(L^2\), which is a minimal memory overhead.

Returns:

Array of wavelet pixel-space coefficients

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

f_scal (torch.tensor): Array of scaling pixel-space coefficients

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

Return type:

f_wav (torch.tensor)

s2wav.transforms.wavelet_precompute_torch.flm_to_analysis(flm: tensor, L: int, N: int = 1, J_min: int = 0, J_max: int | None = None, lam: float = 2.0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, filters: Tuple[tensor] | None = None, precomps: List[List[tensor]] | None = None) Tuple[tensor]#

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

Parameters:
  • f (torch.tensor) – 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.

  • 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.

  • filters (Tuple[torch.tensor], optional) – Precomputed wavelet filters. Defaults to None.

  • precomps (List[torch.tensor]) – Precomputed list of recursion coefficients. At most of length \(L^2\), which is a minimal memory overhead.

Returns:

Array of wavelet pixel-space coefficients

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

f_scal (torch.tensor): Array of scaling pixel-space coefficients

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

Return type:

f_wav (torch.tensor)

s2wav.transforms.wavelet_precompute_torch.synthesis(f_wav: tensor, f_scal: tensor, L: int, N: int = 1, J_min: int = 0, lam: float = 2.0, spin: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, filters: Tuple[tensor] | None = None, precomps: List[List[tensor]] | None = None) tensor#

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 (torch.tensor) – 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 1.

  • 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.

  • 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.

  • filters (Tuple[torch.tensor], optional) – Precomputed wavelet filters. Defaults to None.

  • precomps (List[torch.tensor]) – Precomputed list of recursion coefficients. At most of length \(L^2\), which is a minimal memory overhead.

Raises:

AssertionError – Shape of wavelet/scaling coefficients incorrect.

Returns:

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

Return type:

torch.tensor

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).