Healpix utils

The kszx.healpix_utils module contains wrappers around the healpy library.

Some of these functions don’t currently have healpix equivalents (but healpix equivalents would be easy to write if needed).

References

kszx.healpix_utils.read_map(filename)

Reads healpy map in FITS format, and returns a 1-d array of length npix.

kszx.healpix_utils.write_map(filename, m)

Writes healpy map in FITS formaat.

kszx.healpix_utils.map_from_catalog(nside, gcat, weights=None, rcat=None, rweights=None, normalized=True)

Project a 3-d galaxy catalog to a 2-d healpix map.

Function args:

  • nside (integer): defines Healpix resolution.

  • gcat (Catalog): galaxy catalog. Must define columns ra_deg, dec_deg.

  • weights (1-d numpy array, optional): per-galaxy weights.

  • rcat, rweights (optional): random catalog to be subtracted. The rweights are renormalized so that sum(rweights) = -sum(weights).

  • normalized (boolean): If normalized=True, then the output map includes a factor 1 / (pixel area). This normalization best represents a sum of delta functions \(f(x) = \sum_j w_j \delta^2(\theta - \theta_j)\).

Returns a 1-d array of length npix (= 12*nside**2).

kszx.healpix_utils.read_alm(filename)

Reads alms in FITS format, and returns a 1-d complex array.

kszx.healpix_utils.lmax_of_alm(alm)

Given a 1-d array of length (lmax+1)*(lmax+2)/2 representing alms, returns associated lmax value.

kszx.healpix_utils.degrade_alm(alm, dst_lmax)

Given a 1-d array representing alms, return array truncated to a lower value of lmax.

kszx.healpix_utils.plot_alm(alm, nside=128, fwhm_deg=None, lmax=None)

Given a 1-d array representing alms, plot the associated healpix map.