Pixelating corresponds to sampling it at
locations ,
. The sample
function values f_{p} can then be used
to estimate a_{lm}. A straightforward estimator is
The HEALPix package contains the Fortran90 facility synfast, which takes as input a power spectrum C_{l} and generates a realisation of on the HEALPix grid. The convention for power spectrum input into synfast is straightforward: each C_{l} is just the expected variance of the a_{lm} at that l.
Example: The spherical harmonic coefficient a_{00} is the integral of the over the sphere. To obtain realisations of functions which have a_{00} distributed as a Gaussian with zero mean and variance 1, set C_{0} to 1. The value of the synthesised function at each pixel will be Gaussian distributed with mean zero and variance . As required, the integral of over the full solid angle of the sphere has zero mean and variance .Note that this definition implies the standard result that the total power at the angular wavenumber l is (2l+1)C_{l}, because there are 2l+1 modes for each l.
This defines unambiguously how the C_{l} have to be defined given the units of the physical quantity f. In cosmic microwave background research, popular choices for simulated maps are
CMBFAST makes its outputs in ASCII files, which instead
of C_{X,l} contain quantities defined as
D_{X,l}  (7) 
The version 4.0 of CMBFAST also created a FITS file containing the power spectra C_{X,l}, designed for interface with HEALPix . The spectra for polarization were renormalized to match the normalization used in HEALPix 1.1, which was different from the one used by CMBFAST and by HEALPix 1.2 (see § A.3.2 for details).
The newer version of CMBFAST (4.2, released in Feb. 2003) will generate FITS files containing C_{X,l}, with the same convention for polarization as the one used internally. It will therefore match the convention adopted by HEALPix in its version 1.2.
For backward compatibility, we provide an IDL code (convert_oldhpx2cmbfast) to change the normalization of existing FITS files created with CMBFAST 4.0. When created with the correct normalization (with CMBFAST 4.2) or set to the correct normalization (using convert_oldhpx2cmbfast), the FITS file will include a specific keyword (POLNORM = CMBFAST) in their header to identify them. The map simulation code synfast will issue a warning if the input power spectrum file does not contain the keyword POLNORM, but no attempt will be made to renormalize the power spectrum. If the keyword is present, it will be inherited by the simulated map.

The CMB radiation field is described by a intensity tensor I_{ij} (Chandrasekhar , 1960). The Stokes parameters Q and U are defined as Q=(I_{11}I_{22})/4 and U=I_{12}/2, while the temperature anisotropy is given by T=(I_{11}+I_{22})/4. The fourth Stokes parameter V that describes circular polarization is not necessary in standard cosmological models because it cannot be generated through the process of Thomson scattering. While the temperature is a scalar quantity Q and U are not. They depend on the direction of observation and on the two axis perpendicular to used to define them. If for a given the axes are rotated by an angle such that and the Stokes parameters change as
To analyze the CMB temperature on the sky, it is natural to expand it in spherical harmonics. These are not appropriate for polarization, because the two combinations are quantities of spin (Goldberg , 1967). They should be expanded in spinweighted harmonics (Seljak & Zaldarriaga , 1997; Zaldarriaga & Seljak , 1997),
To perform this expansion, Q and U in equation (9) are measured relative to , the unit vectors of the spherical coordinate system. Where is tangent to the local meridian and directed from North to South, and is tangent to the local parallel, and directed from West to East. The coefficients are observable on the sky and their power spectra can be predicted for different cosmological models. Instead of it is convenient to use their linear combinations
a_{E,lm}  (a_{2,lm}+a_{2,lm})/2  
a_{B,lm}  (a_{2,lm}a_{2,lm})/2i,  (10) 
which transform differently under parity. Four power spectra are needed to characterize fluctuations in a gaussian theory, the autocorrelation between T, E and B and the cross correlation of E and T. Because of parity considerations the crosscorrelations between B and the other quantities vanish and one is left with
where X stands for T, E or B, means ensemble average and is the Kronecker delta.
We can rewrite equation (9) as
where we have introduced and . They satisfy Y^{*}_{lm} = (1)^{m} Y_{lm}, X^{*}_{1,lm}=(1)^{m} X_{1,lm} and X^{*}_{2,lm}=(1)^{m+1}X_{2,lm} which together with a_{T,lm}=(1)^{m} a_{T,lm}^{*}, a_{E,lm}=(1)^{m} a_{E,lm}^{*} and a_{B,lm}=(1)^{m} a_{B,lm}^{*} make T, Q and U real.
In fact and have the form, and , can be calculated in terms of Legendre polynomials (Kamionkowski et al , 1997)
where
(14) 
Note that if m=0, as it must to make the Stokes parameters real.
The correlation functions between 2 points on the sky (noted 1 and 2) separated by an angle can be calculated using equations (11) and (12). However, as pointed out in Kamionkowski et al (1997), the natural coordinate system to express the correlations is one in which vectors at each point are tangent to the great circle connecting these 2 points, with the vectors being perpendicular to the vectors. With this choice of reference frames, and using the addition theorem for the spin harmonics (Hu & White , 1997),
we have (Kamionkowski et al , 1997)
The subscript r here indicate that the Stokes parameters are measured in this particular coordinate system. We can use the transformation laws in equation (8) to write (Q,U) in terms of (Q_{r},U_{r}).
Using the fact that, when
,
and
,
the definitions above imply that the variances of the temperature and
polarization are related to the power spectra by
It is also worth noting that with these conventions, the cross power C_{Cl} for scalar perturbations must be positive at low l, in order to produce at large scales a radial pattern of polarization around cold temperature spots (and a tangential pattern around hot spots) as it is expected from scalar perturbations (Crittenden et al , 1995).
Note that Eq. (12) implies that, if the Stokes parameters are
rotated everywhere via
Finally, with these conventions, a polarization with (Q>0,U=0) will be along the NorthSouth axis, and (Q=0,U>0) will be along a NorthWest to SouthEast axis (see Fig. 5)
Table 1: Relation between CMB power spectra conventions used in HEALPix, CMBFAST and
KKS. The power spectra on the same row are equal.
 
Introducing the matrices
M_{lm}  (20) 
For KKS, with the same definition of M, the decomposition reads
whereas in HEALPix 1.1 it was

The polarization conventions defined by the International Astronomical Union (IAU, 1974) are summarized in Hamaker & Bregman (1996). They define at each point on the celestial sphere a cartesian referential with the x and y axes pointing respectively toward the North and East, and the z axis along the line of sight pointing toward the observer (ie, inwards) for a righthanded system.
On the other hand, following the mathematical and CMB litterature tradition, HEALPix defines a cartesian referential with the x and y axes pointing respectively toward the South and East, and the z axis along the line of sight pointing away from the observer (ie, outwards) for a righthanded system. The Planck CMB mission follows the same convention (Ansari et al, 2003).
The consequence of this definition discrepency is a change of sign of U, which, if not accounted for, jeopardizes the calculation of the Electric and Magnetic CMB polarisation power spectra.
How HEALPix deals with these discrepancies
The FITS keyword POLCCONV has been introduced in HEALPix 2.0 to describe the
polarisation coordinate convention applied to the data contained in the file. Its value is either COSMO for files following the Healpix/CMB/Planck convention (default
for sky map synthetized with Healpix routine
synfast)
or IAU for those
following the IAU convention, as defined above. Absence of this keyword is
interpreted as meaning COSMO.
The change_polcconv IDL facility is provided to add this keyword or change/update its value and swap the sign of the U Stokes parameter, when applicable, in an existing FITS file.
The facility anafast will crash if the map to analyze follows the 'IAU' convention, and issue a warning if the convention used can not be determined.
The Spherical Harmonics are defined as
Introducing
, the associated Legendre Polynomials P_{lm}
solve the differential equation
Note our Y_{lm} are identical to those of Edmonds (1957), even though our definition of the P_{lm} differ from his by a factor (1)^{m} (a.k.a. CondonShortley phase).
Version 3.31, 20170106