glass.healpix — Array API compatible HEALPix functions¶
This module contains functions for working with HEALPix maps in an Array API compliant manner used with GLASS.
This module should be imported manually if used outside of GLASS:
import glass.healpix as hp
healpix Functions¶
- glass.healpix.ang2pix(nside, theta, phi, *, lonlat=False, xp=None)[source]¶
Converts the angle to HEALPix pixel numbers.
- Parameters:
nside (int) – The HEALPix nside parameter of the map.
theta (float | FloatArray) – Angular coordinates of a point on the sphere.
phi (float | FloatArray) – Angular coordinates of a point on the sphere.
lonlat (bool) – If True, automatically adjust latitudes to be within [-90, 90] range.
xp (ModuleType | None) – The array library backend to use for array operations.
- Returns:
The HEALPix pixel numbers.
- Return type:
IntArray
- glass.healpix.ang2vec(theta, phi, *, lonlat=False, xp=None)[source]¶
Convert angles to 3D position vector.
- Parameters:
theta (float | FloatArray) – Angular coordinates of a point on the sphere.
phi (float | FloatArray) – Angular coordinates of a point on the sphere.
lonlat (bool) – If True, automatically adjust latitudes to be within [-90, 90] range.
xp (ModuleType | None) – The array library backend to use for array operations.
- Returns:
A normalised 3-vector pointing in the same direction as
ang.- Return type:
tuple[FloatArray, FloatArray, FloatArray]
- glass.healpix.randang(nside, ipix, *, lonlat=False)[source]¶
Sample random spherical coordinates from the given HEALPix pixels.
rngis no longer a parameter as we must use the NumPy backend otherwise we run into aoperand array with iterator write flag set is read-onlyerror coming from_chp.ring2ang_uv(nside, ipix, u, v, u, v).
healpy Functions¶
- glass.healpix.alm2map(alms, nside, *, inplace=False, lmax=None, pixwin=False, pol=True)[source]¶
Computes a HEALPix map given the alm.
- Parameters:
alms (ComplexArray | Sequence[ComplexArray]) – A complex array or a sequence of complex arrays.
nside (int) – The nside of the output map.
inplace (bool) – If True, input alms may be modified by pixel window function and beam smoothing.
lmax (int | None) – Explicitly define lmax.
pixwin (bool) – Smooth the alm using the pixel window functions.
pol (bool) – If True, assumes input alms are TEB.
- Returns:
A HEALPix map in RING scheme at nside or a list of T,Q,U maps.
- Return type:
FloatArray
- glass.healpix.alm2map_spin(alms, nside, spin, lmax)[source]¶
Computes maps from a set of 2 spinned alm.
- glass.healpix.almxfl(alm, fl, *, inplace=False)[source]¶
Multiply alm by a function of l. The function is assumed to be zero where not defined.
- Parameters:
- Returns:
The modified alm, either a new array or a reference to input alm.
- Return type:
- glass.healpix.map2alm(maps, *, lmax=None, pol=True, use_pixel_weights=False)[source]¶
Computes the alm of a HEALPix map. The input maps must all be in ring ordering.
- Parameters:
maps (FloatArray | Sequence[FloatArray]) – The input map or a list of n input maps. Must be in ring ordering.
lmax (int | None) – Maximum l of the power spectrum.
pol (bool) – If True, assumes input maps are TQU.
use_pixel_weights (bool) – If True, use pixel by pixel weighting, healpy will automatically download the weights, if needed.
- Returns:
alm or a tuple of 3 alm (almT, almE, almB) if polarized input.
- Return type:
FloatArray
- glass.healpix.pixwin(nside, *, lmax=None, pol=False, xp=None)[source]¶
Return the pixel window function for the given nside.
- Parameters:
nside (int) – The nside for which to return the pixel window function.
lmax (int | None) – If True, return also the polar pixel window.
pol (bool) – Maximum l of the power spectrum.
xp (ModuleType | None) – The array library backend to use for array operations.
- Returns:
The temperature pixel window function.
- Return type:
FloatArray | tuple[FloatArray, …]