Saul Aryeh Kohn
Saul Aryeh Kohn

Reputation: 187

Why do healpix "alm" routines return arrays l and m of the same length?

From what I remember of my quantum physics and university maths, for every mode l, there exists m = l-1, l, l+1. Why do healpix (in my case, specifically healpy) spherical harmonic routines, e.g. healpy.sphtfunc.alm2map, return arrays of l and m that are the same length?

Upvotes: -1

Views: 1260

Answers (2)

Gilles
Gilles

Reputation: 514

The missing bits from Andrea Zonca's answer:

  • For every mode l the range of m is actually from -l to +l (so 2l+1 of them). But we are dealing with real signals, for which the alm for opposite m are complex conjugates, so HEALPix does not store the alm values for m<0 (so only l+1 of them).
  • In the alm array returned by hp.map2alm, Andrea's example shows that the ordering is by increasing m then increasing l. You don't need to do the bookkeeping, to know the index of (l≥0,m≥0) in the array alm you can use the convenience function hp.Alm.getidx(lmax,l,m), where lmax = hp.Alm.getlmax(len(alm)).

Upvotes: 3

Andrea Zonca
Andrea Zonca

Reputation: 8773

I think you are referring to map2alm.

Let's check an example:

import numpy as np
import healpy as hp
m = np.arange(12) # define a map
lmax = 2
alm = hp.map2alm(m, lmax=lmax) # spherical armonic transform
print(alm)
[  1.94198894e+01 +0.00000000e+00j  -1.22780488e+01 +0.00000000e+00j
  -3.22928935e-01 +0.00000000e+00j   6.85510448e-01 -2.13069336e+00j
   4.66136940e-16 +6.36302781e-18j  -6.44680479e-01 +1.16180552e+00j]
print(alm.shape)
(6,)

So alm is actually a 1D vector.

How is alm indexed?

l, m = hp.Alm.getlm(lmax=lmax)
print(l)
[0 1 2 1 2 2]
print(m)
[0 0 0 1 1 2]

So, for l = 2, m is [0, 1, 2].

You can find out more about HEALPix in the HEALPix primer: http://healpix.jpl.nasa.gov/pdf/intro.pdf

Upvotes: 4

Related Questions