Rotations#

Wigner functions and rotations, in the conventions of s2fft and of the article.

Rotations are parameterised by \(zyz\) Euler angles, \(R(\alpha, \beta, \gamma) = R_z(\alpha) R_y(\beta) R_z(\gamma)\) (Eq. 1), and the Wigner functions are \(D^{\ell}_{mn}(\alpha, \beta, \gamma) = e^{-\mathrm{i}m\alpha} d^{\ell}_{mn}(\beta) e^{-\mathrm{i}n\gamma}\) (Eq. 6). The reduced functions are computed by the factorisation \(d^{\ell}_{mn}(\beta) = \mathrm{i}^{m-n} \sum_k \Delta^{\ell}_{km} \Delta^{\ell}_{kn} e^{-\mathrm{i}k\beta}\) with \(\Delta^{\ell} = d^{\ell}(\pi/2)\) (Eq. B25), so that every function here is differentiable in the Euler angles.

s2conv.utils.rotation.delta_matrices(L: int) → Array[source]#

Wigner functions at \(\beta = \pi/2\), computed once by the Risbo recursion.

Parameters:

L (int) – Harmonic band-limit.

Returns:

\(\Delta^{\ell}_{km} = d^{\ell}_{km}(\pi/2)\) with shape [L, 2L - 1, 2L - 1], indexed [el, L - 1 + k, L - 1 + m].

Return type:

jnp.ndarray

s2conv.utils.rotation.wigner_d(beta, L: int) → Array[source]#

Reduced Wigner functions \(d^{\ell}_{mn}(\beta)\) for all \(\ell < L\).

Parameters:
  • beta – Second Euler angle (a scalar).

  • L (int) – Harmonic band-limit.

Returns:

Array of shape [L, 2L - 1, 2L - 1] indexed [el, L - 1 + m, L - 1 + n].

Return type:

jnp.ndarray

s2conv.utils.rotation.wigner_D(alpha, beta, gamma, L: int) → Array[source]#

Wigner functions \(D^{\ell}_{mn}(\alpha, \beta, \gamma)\) (Eq. 6).

Parameters:
  • alpha – First Euler angle.

  • beta – Second Euler angle.

  • gamma – Third Euler angle.

  • L (int) – Harmonic band-limit.

Returns:

Array of shape [L, 2L - 1, 2L - 1] indexed [el, L - 1 + m, L - 1 + n].

Return type:

jnp.ndarray

s2conv.utils.rotation.rotate_flm(flm, rotation) → Array[source]#

Rotate the harmonic coefficients of a field of any spin (Eq. 10).

Computes \((\mathcal{R}_\rho f)_{\ell m} = \sum_n D^{\ell}_{mn}(\rho)\, f_{\ell n}\), which holds with the same Wigner matrices for every spin, in \(\mathcal{O}(L^3)\) operations through the factorisation of rotations. Leading axes are broadcast, so Wigner coefficients flmn[..., 2N - 1, L, 2L - 1] may be passed to obtain the left translation \(F(\rho^{-1}\,\cdot\,)\), which acts on the first Wigner index.

Parameters:
  • flm – Harmonic coefficients with shape [..., L, 2L - 1].

  • rotation – Euler angles \((\alpha, \beta, \gamma)\) of the rotation.

Returns:

Coefficients of the rotated field, with the shape of flm.

Return type:

jnp.ndarray

s2conv.utils.rotation.rotate_flmn(flm, rotation) → Array#

Rotate the harmonic coefficients of a field of any spin (Eq. 10).

Computes \((\mathcal{R}_\rho f)_{\ell m} = \sum_n D^{\ell}_{mn}(\rho)\, f_{\ell n}\), which holds with the same Wigner matrices for every spin, in \(\mathcal{O}(L^3)\) operations through the factorisation of rotations. Leading axes are broadcast, so Wigner coefficients flmn[..., 2N - 1, L, 2L - 1] may be passed to obtain the left translation \(F(\rho^{-1}\,\cdot\,)\), which acts on the first Wigner index.

Parameters:
  • flm – Harmonic coefficients with shape [..., L, 2L - 1].

  • rotation – Euler angles \((\alpha, \beta, \gamma)\) of the rotation.

Returns:

Coefficients of the rotated field, with the shape of flm.

Return type:

jnp.ndarray

s2conv.utils.rotation.rotation_matrix(alpha, beta, gamma) → Array[source]#

Rotation matrices \(R_z(\alpha) R_y(\beta) R_z(\gamma)\) (Eq. 1).

Parameters:
  • alpha – First Euler angle(s).

  • beta – Second Euler angle(s).

  • gamma – Third Euler angle(s).

Returns:

Matrices of shape [..., 3, 3], broadcast over the angles.

Return type:

jnp.ndarray

s2conv.utils.rotation.euler_angles(R) → tuple[source]#

\(zyz\) Euler angles of rotation matrices.

Parameters:

R – Rotation matrices with shape [..., 3, 3].

Returns:

The angles \((\alpha, \beta, \gamma)\) with \(R = R_z(\alpha) R_y(\beta) R_z(\gamma)\), \(\beta \in [0, \pi]\). The first and third angles are ill-defined at \(\beta \in \{0, \pi\}\).

Return type:

tuple

s2conv.utils.rotation.section(theta, phi) → Array[source]#

The coordinate section \(s(\theta, \varphi) = R(\varphi, \theta, 0)\) (Eq. 32).

Parameters:
  • theta – Colatitudes.

  • phi – Longitudes.

Returns:

Rotation matrices of shape [..., 3, 3].

Return type:

jnp.ndarray

s2conv.utils.rotation.random_rotation(key) → tuple[source]#

Euler angles of a rotation drawn from the Haar measure on the rotation group.

Parameters:

key – A JAX random key.

Returns:

Euler angles \((\alpha, \beta, \gamma)\).

Return type:

tuple