Indexing#

Index conventions shared by s2conv, following s2fft.

Harmonic coefficients of a spin field are stored as flm[..., el, L - 1 + m] with shape [..., L, 2L - 1]. Wigner coefficients of a function on the rotation group are stored in the s2fft layout flmn[..., N - 1 + n, el, L - 1 + m], the coefficient \(F^{\ell}_{mn}\), with shape [..., 2N - 1, L, 2L - 1] for azimuthal band-limit \(N\).

s2conv.utils.indexing.m_axis(L: int) → ndarray[source]#

Azimuthal orders along the last axis of a coefficient array.

Parameters:

L (int) – Harmonic band-limit.

Returns:

The orders \(-(L-1), \dots, L-1\).

Return type:

np.ndarray

s2conv.utils.indexing.n_axis(N: int) → ndarray[source]#

Orders along the first axis of Wigner coefficients.

Parameters:

N (int) – Azimuthal band-limit.

Returns:

The orders \(-(N-1), \dots, N-1\).

Return type:

np.ndarray

s2conv.utils.indexing.parity(s) → int[source]#

The sign \((-1)^s\) of an integer, valid for negative and NumPy integers.

Parameters:

s – An integer.

Returns:

\((-1)^s\).

Return type:

int

s2conv.utils.indexing.lm_mask(L: int, spin: int = 0) → ndarray[source]#

Entries carried by a band-limited spin field.

Parameters:
  • L (int) – Harmonic band-limit.

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

Returns:

Boolean mask of shape [L, 2L - 1], true where \(\ell \ge |s|\) and \(|m| \le \ell\).

Return type:

np.ndarray

s2conv.utils.indexing.wigner_mask(L: int, N: int) → ndarray[source]#

Entries carried by a function on the rotation group.

Parameters:
  • L (int) – Harmonic band-limit.

  • N (int) – Azimuthal band-limit.

Returns:

Boolean mask of shape [2N - 1, L, 2L - 1], true where \(|n| \le \ell\) and \(|m| \le \ell\).

Return type:

np.ndarray

s2conv.utils.indexing.conjugate(flm, spin: int = 0)[source]#

Harmonic coefficients of the complex conjugate of a spin-\(s\) field (Eq. A9).

The conjugate is a spin \(-s\) field with coefficients \((\,{}_sf^*)_{\ell m} = (-1)^{s+m}\, {}_sf^*_{\ell,-m}\).

Parameters:
  • flm – Spin-\(s\) harmonic coefficients, [..., L, 2L - 1].

  • spin (int, optional) – Spin \(s\). Defaults to 0.

Returns:

Spin \(-s\) harmonic coefficients, [..., L, 2L - 1].

s2conv.utils.indexing.bandlimit(flm) → int[source]#

Harmonic band-limit of spherical harmonic coefficients flm[..., L, 2L - 1].

Parameters:

flm – Harmonic coefficients.

Returns:

The band-limit \(L\).

Return type:

int

s2conv.utils.indexing.azimuthal_bandlimit(flmn) → int[source]#

Azimuthal band-limit of Wigner coefficients flmn[..., 2N - 1, L, 2L - 1].

Parameters:

flmn – Wigner coefficients.

Returns:

The azimuthal band-limit \(N\).

Return type:

int

s2conv.utils.indexing.check_spin(L: int, spin: int, N: int = None) → None[source]#

Check that a spin is representable at the given band-limits.

Parameters:
  • L (int) – Harmonic band-limit.

  • spin (int) – Spin.

  • N (int, optional) – Azimuthal band-limit, if the spin indexes a Wigner column.

Raises:

ValueError – If \(|s| \ge L\), or \(|s| \ge N\) when N is given.