healpy.fitsfunc.read_alm

healpy.fitsfunc.read_alm(filename, hdu=1, return_mmax=False)

Read alm from a fits file.

The file format is assumed to be the format created by write_alm, with 3 columns (index, real and imaginary) for each HDU.

In the fits file, the alm are assumed to be written with explicit index scheme, index = l**2+l+m+1, while healpix cxx uses index = m*(2*lmax+1-m)/2+l. The conversion is done in this function.

Parameters:
filenamestr or HDUList or HDU or pathlib.Path instance

The name of the fits file to read

hduint, or tuple of int, optional

The HDU to read. Default: hdu=1 For example, when reading a FITS file containing polarized alm, hdu=1 (or not specifying hdu) will return the alm_T hdu=(1,2,3) will return alm_T, alm_E, alm_B

return_mmaxbool, optional

If true, both the alms and mmax is returned in a tuple. Default: return_mmax=False

Returns:
alms[, mmax]complex array or tuple of a complex array and an int

The alms read from the file and optionally mmax read from the file