s2ball is currently in an open alpha, please provide feedback on GitHub

Legendre Matrices#

s2ball.construct.legendre_constructor.compute_legendre_warning(L)#

Basic compute warning for large Legendre precomputes.

Parameters:

L (int) – Harmonic band-limit.

Raises:

Warning – If the estimated time for precompute is large (\(L>=256\)).

s2ball.construct.legendre_constructor.construct_legendre_matrix(L: int, save_dir: str = '.matrices', spin: int = 0) ndarray#

Construct associated Legendre matrix which will be called during transform.

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

  • save_dir (str, optional) – Directory in which to save precomputed matrices. Defaults to “.matrices”.

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

Returns:

Associated Legendre matrix for forward harmonic transform.

Return type:

np.ndarray

Note

Currently only McEwen-Wauix sampling on the sphere is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix.

s2ball.construct.legendre_constructor.construct_legendre_matrix_inverse(L: int, save_dir: str = '.matrices', spin: int = 0) ndarray#

Construct associated Legendre inverse matrix for precompute method.

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

  • save_dir (str, optional) – Directory in which to save precomputed matrices. Defaults to “.matrices”.

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

Returns:

Associated Legendre matrix for inverse harmonic transform.

Return type:

np.ndarray

Note

Currently only McEwen-Wauix sampling on the sphere is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix.

s2ball.construct.legendre_constructor.load_legendre_matrix(L: int, save_dir: str = '.matrices', forward: bool = True, spin: int = 0) ndarray#

Load/construct associated Legendre inverse matrix for precompute method.

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

  • save_dir (str, optional) – Directory in which to save precomputed matrices. Defaults to “.matrices”.

  • forward (bool, optional) – Whether to load the forward or inverse matrices. Defaults to True.

  • spin (int, optional) – Spin of the transform to consider. Defaults to 0.

Returns:

Associated Legendre matrix for corresponding harmonic transform.

Return type:

np.ndarray

Note

Currently only McEwen-Wauix sampling on the sphere is supported, though this approach can be extended to alternate sampling schemes, e.g. HEALPix.