aurel.maths
maths.py
- This module contains functions for manipulating rank 2 tensors, including:
extracting components or formatting components into matrices
computing determinants and inverses
symmetrizing or antisymmetrizing tensors
safe division
spin weighted spherical harmonics
- aurel.maths.determinant4(f)[source]
Determinant of a 4x4 matrix in every position of the data grid.
- aurel.maths.getcomponents3(f)[source]
Extract components of a rank 2 tensor with 3D indices.
This assumes this tensor is symmetric.
- Parameters:
f ((3, 3, ...) array_like or list of 6 components [xx, xy, xz, yy, yz, zz])
- Returns:
[xx, xy, xz, yy, yz, zz] – Each element is (…) array_like
- Return type:
list
- aurel.maths.getcomponents4(f)[source]
Extract components of a rank 2 tensor with 4D indices.
This assumes this tensor is symmetric.
- Parameters:
f ((4, 4, ...) array_like or list of 10 components [tt, tx, ty, tz, xx, xy, xz, yy, yz, zz])
- Returns:
[tt, tx, ty, tz, xx, xy, xz, yy, yz, zz] – Each element is (…) array_like
- Return type:
list
- aurel.maths.populate_4Riemann(Riemann_ssss, Riemann_ssst, Riemann_stst)[source]
Populate the 4Riemann tensor with R_ssss, R_ssst, and R_stst
- aurel.maths.sYlm(s, l, m, theta, phi)[source]
Spin-weighted spherical harmonics \({}_sY_{lm}\), Eq 3.1 of https://doi.org/10.1063/1.1705135
- Parameters:
s (int) – Spin weight.
l (int) – Degree.
m (int) – Order.
theta (ndarray) – Inclination/polar angle grid.
phi (ndarray) – Azimuthal angle grid.
- Returns:
sYlm – Spin-weighted spherical harmonics on the (theta, phi) grid.
- Return type:
ndarray
- aurel.maths.sYlm_coefficients(s, lmax, f, theta, phi, dtheta_weight, dphi)[source]
Coefficients of spin-weighted spherical harmonics decomposition of f
- Parameters:
s (int) – Spin weight.
lmax (int) – Maximum l in the expansion.
f (ndarray) – Spin-weighted function on the (theta, phi) grid.
theta (ndarray) – Angular grids.
phi (ndarray) – Angular grids.
dtheta_weight (ndarray) – Weights for integration over theta, e.g. including sin(theta), depending on sampling scheme.
dphi (float) – Step size in phi direction.
- Returns:
alm – Harmonic coefficients.
- Return type:
dict[l,m]
- aurel.maths.sYlm_reconstruct(s, lmax, alm, theta, phi)[source]
Reconstruct a spin-weighted function from its harmonic coefficients.
- Parameters:
s (int) – Spin weight.
lmax (int) – Maximum l in the expansion.
alm (dict[l,m]) – Harmonic coefficients.
theta (ndarray) – Angular grids.
phi (ndarray) – Angular grids.
- Returns:
f – Reconstructed spin-weighted function on the (theta, phi) grid.
- Return type:
ndarray