# healpy.sphtfunc.map2alm¶

healpy.sphtfunc.map2alm(maps, lmax=None, mmax=None, iter=3, pol=True, use_weights=False, datapath=None, gal_cut=0, use_pixel_weights=False, verbose=True)

Computes the alm of a Healpix map. The input maps must all be in ring ordering.

Pixel values are weighted before applying the transform:

• when you don’t specify any weights, the uniform weight value 4*pi/n_pix is used

• with ring weights enabled (use_weights=True), pixels in every ring are weighted with a uniform value similar to the one above, ring weights are included in healpy

• with pixel weights (use_pixel_weights=True), every pixel gets an individual weight

Pixel weights provide the most accurate transform, so you should always use them if possible. However they are not included in healpy and will be automatically downloaded and cached in ~/.astropy the first time you compute a trasform at a specific nside. If datapath is specified, healpy will first check that local folder before downloading the weights. The easiest way to setup the folder is to clone the healpy-data repository: git clone –depth 1 https://github.com/healpy/healpy-data and add the NSIDE 8192 weight from https://github.com/healpy/healpy-data/releases and set datapath to the root of the repository.

Parameters
mapsarray-like, shape (Npix,) or (n, Npix)

The input map or a list of n input maps. Must be in ring ordering.

lmaxint, scalar, optional

Maximum l of the power spectrum. Default: 3*nside-1

mmaxint, scalar, optional

Maximum m of the alm. Default: lmax

iterint, scalar, optional

Number of iteration (default: 3)

polbool, optional

If True, assumes input maps are TQU. Output will be TEB alm’s. (input must be 1 or 3 maps) If False, apply spin 0 harmonic transform to each map. (input can be any number of maps) If there is only one input map, it has no effect. Default: True.

use_weights: bool, scalar, optional

If True, use the ring weighting. Default: False.

datapathNone or str, optional

If given, the directory where to find the weights data.

gal_cutfloat [degrees]

pixels at latitude in [-gal_cut;+gal_cut] are not taken into account

use_pixel_weights: bool, optional

If True, use pixel by pixel weighting, healpy will automatically download the weights, if needed

verbosebool, optional

If True prints diagnostic information. Default: True

Returns
almsarray or tuple of array

alm or a tuple of 3 alm (almT, almE, almB) if polarized input.

Notes

The pixels which have the special UNSEEN value are replaced by zeros before spherical harmonic transform. They are converted back to UNSEEN value, so that the input maps are not modified. Each map have its own, independent mask.