healpy.sphtfunc.map2alm_lsq

healpy.sphtfunc.map2alm_lsq(maps, lmax, mmax, pol=True, tol=1e-10, maxiter=20)

Runs an iterative map analysis up to (lmax, mmax) and returns the result including its quality.

Healpix map analysis is often interpreted as “compute the alm for which alm2map(alm) == map”. Unfortunately this inversion problem is not solvable in many cases, since alm typically has fewer elements than map, which makes the equation system overdetermined, so that a solution only exists for a vanishingly small subset of all possible maps. (Even if there were more alm elements than map pixels it can happen that the problem is unsolvable, but this situation should not be relevant for practical use.)

This function aims to compute instead the alm for which the L2 norm of alm2map(alm) - map is minimal, i.e. it tries to find the best possible least-squares approximation. Since this is an iterative procedure, the user needs to specify a tolerance at which the iteration is stopped and a maximum iteration count to avoid excessive run times in extreme cases.

Compared to map2alm this algorithm has the following advantages and disadvantages:

  • the exact number of iterations need not be specified beforehand, it will stop automatically once the desired accuracy is reached.

  • during calculation it requires more memory than map2alm.

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

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

lmax, mmaxint

The desired lmax and mmax parameters for the analysis

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.

tolfloat

The desired accuracy for the result. Once this is reached, the iteration stops.

maxiterint

maximum iteration count after which the minimization is stopped

Returns:
almnumpy.ndarray(complex)

The reconstructed a_lm coefficients

rel_resfloat

The norm of the residual map (i.e. map-alm2map(alm)), divided by the norm of maps. This is a measure for the fraction of the map signal that could not be modeled by the a_lm

n_iterint

the number of iterations required