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)[source]¶
Converts the angle to HEALPix pixel numbers.
- Parameters:
nside (
int) – The HEALPix nside parameter of the map.theta (
Union[float,Any]) – Angular coordinates of a point on the sphere.phi (
Union[float,Any]) – Angular coordinates of a point on the sphere.lonlat (
bool) – If True, automatically adjust latitudes to be within [-90, 90] range.xp – The array library backend to use for array operations.
- Returns:
The HEALPix pixel numbers.
- Return type:
- glass.healpix.ang2vec(theta, phi, *, lonlat=False)[source]¶
Convert angles to 3D position vector.
- Parameters:
- Returns:
A normalised 3-vector pointing in the same direction as
ang.- Return type:
- 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 (
Union[Any,Sequence[Any]]) – 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.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:
- 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.
If you are running in an offline environment, you must provide a datapath to local healpy datafiles. To download these files:
git clone –depth 1 https://github.com/healpy/healpy-data cd healpy-data bash download_weights_8192.sh
and set datapath to the root of the repository. If this method is used, the only supported values of nside are 2^n for n in the range 5-13.
- Parameters:
- Returns:
alm or a tuple of 3 alm (almT, almE, almB) if polarized input.
- Return type:
- glass.healpix.pixwin(nside, *, lmax=None, pol=False, xp=None)[source]¶
Return the pixel window function for the given nside.
If you are running in an offline environment, you must provide a datapath to local healpy datafiles. To download these files:
git clone –depth 1 https://github.com/healpy/healpy-data cd healpy-data bash download_weights_8192.sh
and set datapath to the root of the repository. If this method is used, the only supported values of nside are 2^n for n in the range 5-13.
- Parameters:
- Returns:
The temperature pixel window function.
- Return type: