1

I am trying to create a map of the monopole (l=0, m=0), dipoles (l=1, m=-1,0,1) and quadrupoles (l=2, m=-2,-1,0,1,2) of the spherical harmonics using Healpy. So far I constructed this extremely simple code with the help of the healpy tutorial:

import numpy as np
import healpy as hp

NSIDE=128
m=np.arange(hp.nside2npix(NSIDE))
x=hp.pixelfunc.fit_monopole(m, nest=False)
y=hp.pixelfunc.fit_dipole(m, nest=False)

but this just returns the values of the monopole (x) and the value of the monopole and dipole (y):

In [22]: print x
98303.5

In [23]: print y
(98303.5, array([ -4.59988602e-01,  -1.81289977e+02,  -9.83040000e+04]))

When I try hp.mollview(x) I get the following error:

TypeError: 'float' object is not iterable

How can I create maps of the monopole and dipoles. Also how do I create maps of the quadrupoles?

1 Answer 1

0

A monopole is a constant value on the map, so:

m[:] = 0.1

For the dipole and quadrupole, you can either:

  • get the coordinates of the pixel centers with hp.pix2ang and use the geometric definitions of dipole and quadrupole
  • create first a set of C_ell values with nonzero dipole or quadrupole

    cl = np.zeros(513, dtype=np.float)
    cl[1] = 100.
    

    then transform to a map with hp.synfast(cl, nside).

The first method is exact, the second is approximate but easier.

You should read the HEALPix Primer to better understand how HEALPix works, google for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.