Search code examples
pythonnumpyhealpy

How do HEALPix FITS files of CMB maps translate into ndarrays? What are the coordinates?


I'm using Healpy (the HEALPix tools developed in Python) to read and write full-sky CMB maps.

I am confused as to how the coordinates of pixels on a sky map translates into entries of a numpy ndarray. How does one HEALPix pixel in a FITS file translate into an ndarray entry?

For example, let's say I have a generated CMB map, Nside=64, lmax=64, using the default RING scheme. The total number of pixels is given by Npix=12*Nside**2. So, for my example, that is 49152 total number of pixels.

The FITS file I have is in the format 1 column by 48 rows. (The 1 column is all temperature values.) So, I transform this file into a n-dim numpy ndarray. The shape of this array gives (48,1024).

Question 1: Is this 2-d array a projection of all the map pixels on the sky into "matrix" form? I think it is. Using my example, 48*1024 = 49152, the total number of pixels.

Question 2: Where does the 1024 standard come from? What does this mean in terms of a HEALPix map and its coordinates? How does one 2-dim ndarray entry (pixel) relate to another (by angle, by HEALPix position, etc.)?

For another example, map Nside=1024. When I convert this into a 2-dimensional ndarray, I get the shape (12288, 1024).

EDIT: Why does this convention of 1024-element arrays exist? How does this correspond to the pixel coordinates on a map?


Solution

  • the best source of information about the HEALPIX pixelization is the Healpix primer:

    http://healpix.jpl.nasa.gov/html/intro.htm

    A map is a 1-dimensional vector, each index is a pixel in the sky. you can turn pixel number into coordinates in the sky using hp.pix2ang.

    Shaping it in rows of 1024 is just a trick to make read/write to disk faster.