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

Spherical Harmonic Transform#

s2fft.base_transforms.spherical.forward(f: ndarray, L: int, spin: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, L_lower: int = 0) ndarray#

Compute forward spherical harmonic transform.

Uses a vectorised separation of variables method with np.fft.

Parameters:
  • f (np.ndarray) – Signal on the sphere.

  • L (int) – Harmonic band-limit.

  • spin (int, optional) – Harmonic spin. Defaults to 0.

  • sampling (str, optional) – Sampling scheme. Supported sampling schemes include {“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 the signal on the sphere is real. If so, conjugate symmetry is exploited to reduce computational costs. Defaults to False.

  • L_lower (int, optional) – Harmonic lower-bound. Transform will only be computed for \(\texttt{L_lower} \leq \ell < \texttt{L}\). Defaults to 0.

Returns:

Spherical harmonic coefficients.

Return type:

np.ndarray

s2fft.base_transforms.spherical.inverse(flm: ndarray, L: int, spin: int = 0, sampling: str = 'mw', nside: int | None = None, reality: bool = False, L_lower: int = 0) ndarray#

Compute inverse spherical harmonic transform.

Uses a vectorised separation of variables method with np.fft.

Parameters:
  • flm (np.ndarray) – Spherical harmonic coefficients.

  • L (int) – Harmonic band-limit.

  • spin (int, optional) – Harmonic spin. Defaults to 0.

  • sampling (str, optional) – Sampling scheme. Supported sampling schemes include {“mw”, “mwss”, “dh”, “gl”, “healpix”}. Defaults to “mw”.

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

  • reality (bool, optional) – Whether the signal on the sphere is real. If so, conjugate symmetry is exploited to reduce computational costs. Defaults to False.

  • L_lower (int, optional) – Harmonic lower-bound. Transform will only be computed for \(\texttt{L_lower} \leq \ell < \texttt{L}\). Defaults to 0.

Returns:

Signal on the sphere.

Return type:

np.ndarray