Methods For CMB Map Analysis
Methods For CMB Map Analysis
ABSTRACT
This introductory guide aims to provide insight to new researchers in the field of cosmic microwave
arXiv:2410.12951v1 [astro-ph.CO] 16 Oct 2024
background (CMB) map analysis on best practices for several common procedures. I will discuss
common map-modifying procedures such as masking, downgrading resolution, the effect of the beam
and the pixel window function, and adding white noise. I will explore how these modifications affect
the final power spectrum measured from a map. This guide aims to describe the best way to perform
each of these procedures, when the different steps and measures should be carried out, and the effects
of incorrectly performing or applying any of them.
INTRODUCTION
When studying all-sky cosmic microwave background (CMB) maps, some analysis operations come up frequently,
and for non-experts it is not always clear what the optimal choices to make are, and why. As such, this guide is aimed
at those who are just starting in the world of all-sky CMB analysis, and those who are more experienced but have
wondered whether it really matters if you apodize the mask, smooth by the beam, or apply the pixel window function,
or have ever been confused about how to add noise to your map or your power spectrum, or how to downgrade the
resolution of your map correctly. We make no claims of completeness but hope this note will act as a useful guide.
This discussion will mostly reference the python package healpy (Zonca et al. 2019), but also the original HEALPix
code (Górski et al. 2005).1 I will discuss data sets with a wide range in angular resolution, beam size, and masking.
The relevant codes mentioned here are still being updated, so conventions may change, functions may be updated,
or new functionality added.2 It is highly recommended that users also read the Healpix Primer (Gorski et al. 1999)
which covers some of the same topics in greater detail, though with fewer example figures.
RECOMMENDED READING GUIDE FOR BEGINNERS
Before delving into the details described here, new researchers in the field of CMB analysis should read several other
sources. For using healpy and HEALPix it is recommended that the user reads Górski et al. (2005) and goes through
the tutorials on the healpy documentation. For results regarding masking it is recommended to read through Hivon
et al. (2002), Mortlock et al. (2002) and the documentation by Alonso et al. (2023) if using NaMaster to obtain the
pseudo-Cℓ s. In general, for covering several background topics regarding map-making procedures and noise properties,
it is recommended that the user read Tegmark (1997). There are many other useful resources at an accessible level to
the new researcher, but starting with these will give good preparation for starting your own CMB analysis.
THE BASICS
A HEALPix (Hierarchical Equal Area isoLatitude Pixelation) map is pixelized such that data on a sphere has pixels
of equal area, aligned around lines of equal latitude and with different resolutions nested in a simple way. This is very
useful for integration-type procedures and thanks to the availability of the library of routines, HEALPix is very easy to
use.
[email protected]
1 Some results in this paper were derived using the healpy and HEALPix packages, http://healpix.sourceforge.net
2 For example, while writing this document there was a HEALPix version released using Julia exclusively, https://ziotom78.github.io/
Healpix.jl/dev/
2
A HEALPix map’s resolution is defined by its Nside . The Nside of the map must be a power of 2 (1, 2, 4, 16, . . . ) and
2
the number of pixels in a map is then Npix = 12 × Nside , such that an Nside = 1 map has 12 pixels, an Nside = 2 map
3
has 48 pixels, and so on.
The side-length resolution of a pixel (which we will call θr ) of a particular Nside , can be crudely approximated as (in
radians)4 s s
4π 4π
θr = = 2 . (1)
Npix 12Nside
The pixel data in a HEALPix map may be stored in two possible formats, called ‘Nested’, and ‘Ring’ ordering. The
nested choice ‘nests’ the information within large pixels on the sphere, whereas the ring ordering is arranged within
rings of data of approximately equal latitude travelling down from the north pole in a spiral. Both are one-dimensional
arrays of information, and most functions are set to be able to understand both formats.
The Planck maps from the Planck Legacy Archive (PLA),5 for example, are all stored in ring format, and this is
often (but not always) listed in the FITS6 files. For large data runs it is worth testing both in the ring and nested
format to compare their efficiencies – nested is often more parallelizable, but the ring format has been optimized such
that it will often run equally fast or faster when accounting for conversion time between ring and nested formats.7
It is good practice to save maps in a FITS format including all relevant data in the header, including the units, for
example, in addition to the nest/ring format.
GOING FROM THE POWER SPECTRUM TO A MAP
If you are making your own simulated CMB maps you will often start from an idealized power spectrum. This
you might have obtained from the best fit from the PLA, or perhaps you produced it using the Boltzmann codes
CAMB (Lewis & Challinor 2011; Lewis et al. 2000) or CLASS (Lesgourgues 2011a; Blas et al. 2011; Lesgourgues 2011b;
Lesgourgues & Tram 2011). The file will include the spectra and cross-spectra, i.e. temperature and polarisation
(T T, EE, BB, T E, T B, EB) or (T T, EE, BB, T E).8
For any of T , E or B, we can write the spherical harmonic transform as
ℓX
max ℓ
X
a(θ, ϕ) = aℓm Yℓm (θ, ϕ) , (2)
ℓ=0 m=−ℓ
Cℓ = ⟨|aℓm |⟩ , (3)
Z 2π Z π
∗
aℓm = Yℓm (θ, ϕ)a(θ, ϕ) sin(θ)dθdϕ , (4)
0 0
where θ, ϕ in map space are replaced by discrete pixels, and the maximum multipole ℓmax is in principle ∞, but in
practice for a particular map will be 2 or 3 Nside ,9 and the minimum is in practice 0 but usually start at ℓ = 2 with the
first two rows (for the monopole and dipole) either omitted or set to zero. This limit loosely comes from the intrinsic
resolution of the map, since ℓ can be approximated to measure a wavelength on the sphere of λ = 2π/(ℓ + 1). For
the case that the aℓm are complex rather than real, the sum over m will run from 0 to ℓ. An additional complication
is that the non-zero cross-spectra mean that the final Cℓ will need to interrelate the various T, E and B maps, and
given some Cℓ for T T, EE, BB, T E, T B, EB the aℓm will need to correctly account for all the cross-spectra in the
calculation of the final T , E and B spectra Gorski et al. (1999); Reinecke & Seljebotn (2013).
In the map space, it is more common to measure the polarization using the Stokes Q and U parameters. Q is the
intensity of the radiation polarized in the ‘plus’ orientation (up/down minus left/right, where ‘up’ typically points
3 You can also find the number of pixels using the healpy function healpy.nside2npix(nside), where nside is the desired Nside .
4 Equation (1) is a gross approximation, given that the pixels vary in their shapes depending on their location on the sphere. It can also be
found using the healpy function healpy.nside2resol(nside).
5 https://pla.esac.esa.int/
6 Flexible Image Transport System (FITS) was designed specifically for astronomical data but is generically useful for multi-dimensional
agonals first (T T, EE, BB, T E), whereas healpy will by default expect to receive the spectra ordered by row, i.e. (T T, T E, T B, EE, EB, BB)
or (T T, T E, EE, BB). Since T B and EB are expected to be zero for standard cosmologies they will often be omitted or arrays of zeros.
Newer versions of healpy allow the user to specify the diagonal ordering with the keyword argument new=True.
9 healpy will by default set the limit to be 3 N
side − 1 (somewhat arbitrarily), but you can choose a higher or lower Nside manually. The
conversion from the map to harmonic space is not perfect though, in general, ℓ above 2Nside should not be trusted unless you dramatically
increase the number of iterations. healpy.sphtfunc.map2alm lsq(maps, lmax, mmax, tol=1e-10, maxiter=20) will run until either the
desired tolerance (tol) is met, or the maximum iterations have passed (maxiter) and will also return a residual map.
3
towards Galactic north), and U is rotated by 45◦ , as a cross. Polarization has an orientation on the sky, compared
to the pure intensity or temperature measurements, and as such has a coordinate-system dependence. For more on
polarisation, I recommend Hu & White (1997) and Kamionkowski et al. (1997). The T , Q, and U maps must also
account for all these correlations, and the Q and U maps will, of course, be pseudo-vector component maps, in contrast
to the scalar T , so these will need to be treated differently in some cases.10 We can go from Q and U maps to E and
B power spectra by taking a spin-2 spherical harmonic decomposition of the pseudovectors,
∞ X
ℓ
(±2)
X
(Q + iU )(θ, ϕ) = aℓm ±2 Yℓm (θ, ϕ) . (5)
ℓ=2 m=−ℓ
We can then convert from the spin-2 form to the scalar form,
1 (2) (−2)
aE
ℓm = − aℓm + aℓm , (6)
2
i (2) (−2)
aB
ℓm = aℓm − aℓm . (7)
2
To generate the aℓm s from the Cℓ s in the simplest case, without accounting for the various cross-spectra, each aℓm will
be given by a Gaussian distribution with a mean of zero and a variance given by the value of Cℓ at that ℓ,
aℓm = N (0, Cℓ ) , (8)
which can then be pixelated into a map via eq. (2).11 Often the spectra and cross-spectra are plotted as
ℓ(ℓ + 1)
Dℓ ≡ Cℓ , (9)
2π
whereas Cℓ is what you use to make the maps. The map units can also vary from CMB temperature (Kelvins (K) or
µK, also ‘unitless’ or KCMB 12 ) in terms of fluctuations related to the CMB monopole or Rayleigh jeans intensity units.
COSMIC VARIANCE
Our CMB sky is simply one realisation of the power spectrum, which in the simplest models is Gaussian and random,
with the modes chosen to have a mean of zero and a standard deviation given by the power spectrum at each multipole
ℓ. When you initially take a smooth and ideal CMB power spectrum to make a map, and then convert back to the
power spectrum, you will see that the resulting spectrum has a much more scattered appearance than the input (see
fig. 1). Each time you generate a map you will get a different version of this randomness, but all are statistically
identical. This is what is being referred to when we talk about ‘cosmic-variance’ – the notion that since we can only
observe a single Universe, there is an intrinsic scatter that exists between the ensemble average and our single sky.
This scatter can be calculated using
2 2
Var(C̃ℓXY ) = C XY , (10)
2ℓ + 1 ℓ
where XY ∈ T T, EE, BB, T E, T B, EB. This is the lowest theoretically possible variance for the power spec-
tra Kamionkowski & Loeb (1997). Our sky is just one random realisation of the underlying power spectrum, and
for the lowest ℓ modes we can make very few independent ‘observations’ of these modes (2ℓ + 1 at most) to estimate
the power. This cosmic variance is, of course, largest for the smallest multipoles, and decreases with higher ℓ. When
we map less then the full sky the variance is larger, by a factor of 4π/fsky , which is called the sample variance Scott
et al. (1994).
THE BEAM
When a CMB telescope points itself at the sky, it takes a fuzzy picture. We go from what is an infinite-resolution
majesty down to a set of blurry blobs. This is the effect of the beam of the telescope, which averages the sky within
10 HEALPix will handle the various transforms to produce the spectra, cross-spectra and maps, with an extensive spherical transform library.
11 To compute a set of aℓm from Cℓ use the function synalm, to obtain the aℓm s from a map use map2alm, to compute the Cℓ s from the aℓm s
use alm2cl and to compute the Cℓ s from a map use anafast.
12 Often temperature will be normalized to the temperature of the CMB monopole, or 2.7255 K, these will be given units of K
CMB or TCMB
4
6000
TT 40 EE
D` from map D` from map
Input theory Input theory
D`EE / µK2
D`T T / µK2
4000 30
20
2000
10
0 0
100 101 102 103 0 500 1000 1500 2000 2500 3000
` `
Figure 1. Comparison of taking a pure smooth theoretical CMB power spectrum, going to a map, and then computing the
power spectrum once more. Note how the scatter increases for the lower multipoles and decreases at higher multipoles. This
demonstrates the notion of “cosmic variance”, which is to say that we can only measure one sky, so the intrinsic variance on
the lowest multipoles is large, since it can only be sampled a small number of times across the sky. A T T example is shown on
the left and EE on the right.
its resolution element, with a shape that might be approximately Gaussian in the simplest case. This Gaussian will
have some full-width-at-half-maximum (FWHM) size, often quoted as the telescope’s angular resolution. Real data
processing can be much more complicated, with surveys like Planck having different beams for the different frequencies
or even the different detectors, and with complicated scanning patterns. However, at its most basic level, the telescope’s
optics consisted of a 2D Gaussian profile convolving our real sky. To emulate this when you are building a smoothed
map, you should convolve the power spectrum with a Gaussian beam; HEALPix and healpy allow you to do this quite
easily, with several Gaussian smoothing options, and options to smooth with a custom beam as well.
In the power spectrum the effect is to damp the power at the high ℓs; the smaller your beam the higher ℓ you retain
good information on, and the bigger the beam the quicker you lose this information (see figs. 2 and 3).13
To compute the spectrum profile Bℓ of a Gaussian beam with standard deviation σ:
p
FWHM = 8 ln(2)σ; (11)
1 2
Bℓ = e− 2 ℓ(ℓ+1)σ ; (12)
− 21 ℓ(ℓ+1)σ 2 2σ 2
2 Bℓ =e e ; (13)
Cℓobs = Bℓ2 Cℓ . (14)
2
The factor of e2σ in eq. (13) is an approximation to go from the temperature or scalar field beam to the beam
appropriate for the polarisation (or spin-2) fields (Challinor et al. 2000). This factor is typically small, e.g. for a beam
with a FWHM of 5 arcmin it is 1 + 7.63 × 10−7 . To simulate a real experiment, or to compare a real experiment to
theory, it is important to include the beam in your considerations (either deconvolving the data with the beam or
convolving the beam with your theory).
THE PIXEL-WINDOW FUNCTION
The pixel-window function is an often misunderstood step in the simulation process. What this does not do is model
the pixelisation process performed by HEALpix. What it does do is model how observations on the sky are averaged
into pixels. In a typical experiment, there will be many observations at many points on the sky and you will average
these observations down into a single pixel. The pixel size is often chosen to have about 3 pixels per beam FWHM,14 .
In any case, you must convolve with the pixel-window function to model this averaging step. Depending on the interest
in higher multipoles, the size of the beam, and the pixelisation chosen, this will usually be less significant than the
beam (but is still important!). Like the beam, this function can be arbitrarily complicated – since the telescope’s
13 HEALPix by default will convolve with a beam of 420 arcmin when using the routine synfast, whereas healpy will not.
14 This is sometimes referred to as ‘Nyquist sampling’ but unlike in actual Nyquist sampling you can gain more information in the CMB
power spectrum by having more pixels, albeit at the cost of more noise per pixel, and this is just a guideline, not a rule. You should always
have smaller pixels than your beam so that you can sample the beam properly, however.
5
1.0
Gaussian Beams
50 FWHM
0.8
400 FWHM
0.6
B`
0.4
0.2
0.0
0 1000 2000 3000 4000 5000 6000
`
Figure 2. Comparison of beams of 5 arcmin and 40 arcmin. The larger the FWHM the more quickly the higher modes are
smoothed or damped out.
6000 TT 40 EE
D`EE / µK2
D`T T / µK2
30
4000
20
2000
10
0 0
100 101 102 103 0 500 1000 1500 2000 2500 3000
` `
Figure 3. Comparison of power spectrum results from Gaussian-beam-smoothed maps for T T and EE power spectra. Dividing
by the beam squared, in this case, returns a good approximation for the input theory. In more realistic cases, with noise for
example, this division by the beam amplifies the noise at high ℓ. It can also amplify numerical uncertainties at high ℓ when
smoothing is more extreme, as seen in the spike around ℓ of 1500 in the deconvolved FWHM = 40 arcmin case.
scanning pattern, the shape of the pixels, and the telescope’s beam may all come into play in the final averaging step.
Nevertheless, it is often sufficient to use the pixel-window function provided by HEALPix and healpy to model this
step (although it assumes that your beam is constant across the sky, the scanning pattern is uniform, and that the
pixels are well and evenly sampled). You can see that the pixel window function is approximately a sinc function in
the top panel of fig. 4:
ℓθr
Pℓsinc = sinc , (15)
2π
where θr is the side length resolution of a pixel defined in eq. (1). The functions provided by HEALPix are more
sophisticated, however, and should be used preferentially over the sinc approximation.15 The HEALPix window functions
come from the actual spherical harmonic transform of an average HEALPix pixel for Nside less than 128, and extrapolated
to higher Nside using a tophat approximation for the pixel (see Ref. Gorski et al. (1999)).
15 HEALPix will by default convolve with the pixel window function, whereas healpy will not when using synfast or alm2map.
6
−0.25
P`sinc − P`HEALPix
0.010
0.005
0.000
0.8
4000 D` /P`2 D` /P`2
0.6
2000 0.4
0.2
0 0.0
0 25 50 75 100 125 150 175 0 25 50 75 100 125 150 175
` `
Figure 4. Effects of the pixel-window function. The top panel shows this function for different Nside values; the Nside = 64
map loses a significant amount of power by ℓ = 150, whereas for Nside = 2048 a similar amount of power is lost only by ℓ = 5000.
The bottom panels show the resulting power spectra from a map convolved with the pixel window function at Nside = 64 and
the deconvolved spectrum once divided by the pixel window function squared.
The beam and pixel-window functions are very similar in that each is an observation-driven effect, which reduces
the observing power of a particular telescope at small scales (high-ℓ modes). Unlike the beam (which is driven entirely
by the telescope’s specifications) the pixel window function has more flexibility. We focus on HEALPix for this paper,
but many studies will choose to use Cartesian mapping and square pixels. What is important is that both the beam
and the pixel-window function are well understood and accounted for in your analysis. Putting together the beam and
the pixel effect, thus improving our model for a realistic sky, we now have
Cℓobs = Pℓ2 Bℓ2 Cℓ . (16)
DOWNGRADING A MAP
It is common to downgrade the resolution of a CMB map; lower-resolution maps will have less noise per pixel, require
fewer computing resources, and can be simpler to analyze. The cost is the loss of the higher resolution information
(although this may be noise-dominated anyway). While it may be tempting to use the healpy or HEALPix function
ud grade, this will convolve your standard scalar CMB map (such as temperature, E or B maps) with the new pixel
window function. It is, in essence, averaging all the information from the smaller pixels into the larger pixels and
gives the appearance, mathematically, of convolving itself with the new pixel window function. This is an imperfect
way to envisage this procedure, since the initial pixels may not very densely cover the final pixels, and if the initial
map already had a beam or pixel window function applied to it then the final window function would need to account
7
6000 TT 1.2
EE
1.0
D`EE / µK2
D`T T / µK2
4000 0.8
0.6
2000 0.4
0.2
0 0.0
0 25 50 75 100 125 150 175 0 25 50 75 100 125 150 175
` `
Figure 5. Results for different downgrading methods going from Nside = 2048 to Nside = 64. The correct downgrading method
first takes the map to harmonic space (aℓm ), zeros the high-ℓ components (above 3 Nside − 1, or conservatively above 2 Nside )
and finally converts to a map at a lower Nside . In these panels, the orange and red lines show these scenarios. Using the
healpy.ud grade() function results in low power on small scales for the final maps, represented by the blue line. This averaging
of the pixels has in effect convolved the map with some approximation of the new resolution’s pixel window function. The green
line shows the results after failing to null the high ℓs, which leads to an overestimate of the power on the small scales – this can
be quite extreme for the E modes especially.
for all of those issues as well. This is perhaps argument enough that the ud grade function should not be used to
downgrade a typical CMB map. For the non-scalar maps, such as the Q and U polarisation maps, the ud grade
function should never be used, since it fails to correctly average the vectors in the Q and U maps, treating them as
scalar values. Instead of using ud grade when downgrading a map, one should first obtain the aℓm s of the map, and
downgrade these in harmonic space. The functions used for HEALPix and healpy require that the highest ℓs of the
input power spectrum are zero – for this reason, you must manually set these high ℓs to zero or risk there being excess
power at small scales in your maps. Typically you want retain ℓ no higher than ℓmax = 3Nside − 1, or conservatively
ℓmax = 2Nside .16
In fig. 5 we show the results from a simple map with no beam and no pixel window function downgraded from
Nside = 2048 to Nside = 64. First, we downgrade using the ud grade function, which results in low power at the
highest ℓs due to the implicit convolution with the new pixel window function. This convolution cannot be fixed by
simply deconvolving by the pixel-window function, since the initial map does not have very good coverage of the final
pixels. Next, we take the same initial map and go to aℓm space. From here we show the results of returning directly
back to a lower resolution map, without nulling the high multipoles, and find that it leads to a large excess of power at
the highest ℓs, in particular, this can be a substantial effect for the EE power-spectrum. Lastly, we show the results
after nulling ℓ modes above 3 Nside − 1 and above 2 Nside before returning to the lower resolution map. Both of these
shows very good recovery of the input theory and map power spectrum.
In realistic simulations your original map will have both a beam and a pixel window function; in this case, you must
deconvolve with the original functions and reconvolve with the new pixel window function and beam:
ℓmax
Bℓnew Pℓnew old
anew
ℓm = a , (17)
Bℓold Pℓold ℓm 0
where ℓmax is the new maximum multipole for the lower Nside . In the case where there are foreground contaminants
that you plan to mask later in the analysis, it is a good idea to downgrade the mask similarly. The new mask can be
reconverted to binary by choosing a threshold (typically 0.9) to reset the values lower than the threshold to zero, and
16 When going directly from Cℓ s to maps using synfast, it is not as important to ensure that the high ℓs are nulled out, since these are
handled properly by the map-building function; however, when going from aℓm s to a map using healpy’s alm2map function it is crucial.
8
higher to one. You can choose the threshold to ensure that any foreground contaminants that leak beyond the range
of the original mask are still masked in the new downgraded mask. You should downgrade the map before masking as
well, if at all possible, to ensure that no masking effects are introduced through this process.
WHITE NOISE
The simplest noise properties to add to the data is white noise, which is flat in Cℓ space. Additional complexities
including the scanning pattern of the telescope, 1/f noise, foreground residuals and other details can be added with
additional effort, but for the simplest case (as is often desired when troubleshooting code for example), white noise
is a good starting point. Adding white noise is a simple procedure and may be done at the map level or the power
spectrum level. White noise is a constant addition to each of the multipoles in the power spectrum (in effect simply
increasing the standard deviation for each of the modes), or a random number with a mean of zero and a standard
deviation at the level of the noise added to each of the pixels in a map. Given the noise ϵ in units of K · arcmin, the
noise per multipole is the conversion from arcminutes to radians squared,
2
π
ϵℓ = ϵ2 , with [ϵℓ ] = K2 , (18)
60 × 180
[ϵ] = K · arcmin, (19)
and the noise per pixel ϵpix is the division by the side length resolution θr in arcminutes,
ϵ
ϵpix = , with [ϵpix ] = K, (20)
θr
[ϵ] = K · arcmin, (21)
[θr ] = arcmin. (22)
As expected, the noise is lower for larger pixels and larger for smaller pixels and is flat in ℓ space. As an example,
the noise in the Planck maps was around 2.3 × 10−5 K arcmin, so the noise per pixel in an ϵside = 2048 map would be
around 1.3 × 10−5 K, since a pixel has a resolution
√ of 1.72 arcmin, and ϵℓ would be 4.5 × 10−5 µK2 . Often the noise
in the temperature maps will be a factor of 2 smaller than that in the Q and U maps, due to the way the data are
split, with full data included in the temperature maps, and half the data included in each of the polarisation maps.
Depending on how your noise is defined, it generally should not be convolved with the beam and the pixel window
function, since this would artificially damp the high-ℓ noise (for pure flat white noise). So we now have
which accounts for the beam and pixel window functions applied to the sky, as well as the white noise. The noise will
be a much smaller portion of the temperature power spectrum than for the E-mode power spectrum (see fig. 6).
THE MASK
Of the procedures described in these notes, masking is likely the most complicated topic that will be discussed. Put
simply, the mask should null out areas of the sky that are heavily contaminated with residuals. For the CMB, this is
usually the region along the Galactic plane where foregrounds are dominant, but could also involve masking areas of
point sources outside the Galactic plane.
The simplest mask will consist of ones and zeros, but the sharp edges of the mask can lead to ringing in the final
power spectrum, since you are effectively applying a 2D top hat filter to a sky, and then taking the spherical equivalent
of a Fourier transform. One way to reduce the ringing is to soften the mask edges through ‘apodisation’. How you
choose to apodise, and by how much, should be carefully considered and tested on any analysis you might perform.
Additionally, the method you use to go from the map to the power spectrum and back should be done with care. For
high ℓ it is preferable to use a pseudo-Cℓ approach, such as the MASTER (Hivon et al. 2002) method used by codes
like NaMaster (Alonso et al. 2023), while for the low ℓ it is better to use a quasi-maximum likelihood (QML) method,
such as in Eclipse (Bilbao-Ahedo et al. 2021, 2023) and xQML (Vanneste et al. 2018). There are also methods such
as PolSpice (Challinor et al. 2011) that use the correlation estimator in map space to estimate the power spectrum.
9
Input noise: = 30 µK arcmin (corresponding to pix ≈ 17.5 µK for Nside = 2048 with θr ≈ 1.7 arcmin)
Theory C` ` ≈ 7.6 × 10−5 µK2 C` + `
6000
TT EE
100
D`EE / µK2
D`T T / µK2
4000 75
50
2000
25
0 0
100 101 102 103 0 500 1000 1500 2000 2500 3000
` `
Figure 6. The effect of adding white noise added to the power spectrum. In this idealistic case, there is no beam or pixel
window function and the noise has been added directly to the power spectrum, not the map. The noise level applied here was
ϵℓ = 7.6 × 10−5 µK2 or ϵ = 30 µK · arcmin. In a more realistic scenario the noise levels for temperature and polarisation would
be different, but for simplicity we are assuming the same noise here. Note that since we plot Dℓ , the otherwise constant noise
spectrum ϵℓ increases with ℓ2 .
I will not recommend the use of any one particular mask, apodisation technique or spherical harmonic decomposition
technique, but rather aim to emphasize the complexities associated with masking.
To emphasize the effect of apodisation (of which pymaster, the Python wrapper of NaMaster, provides a few options),
I analyse the impact of the mask on the power spectrum estimate for a range of map types. Specifically, I use the
so-called “common” Planck mask, a pure Galactic-cut mask, along with a point source mask. All the masks are
provided on the PLA17 in their un-apodised form and for Nside = 2048.
I have used the ‘C1’ apodisation provided by NaMaster on all of them with an apodisation length of 0.5◦ and 5.0◦ ,
which smoothly interpolates over that length scale between the zero and one values of the binary masks.18 Figure 7
gives an overview of all these masks, and fig. 8 shows how apodisation improves the power spectrum estimation, greatly
expanding the well recovered multipole range.
Depending on the technique used to estimate the Cℓ s, the mask will reduce the amplitude of the power spectrum,
which can be corrected by multiplying the theory (or dividing the observation) by the fraction of the sky masked;19
Npix
1 X 2
fsky = M , (24)
Npix i=0 i
where Mi = 0 if masked and Mi = 1 if unmasked for the un-apodised mask, otherwise Mi will be some value ranging
from 0 to 1 for unmasked pixels. The effect of this fsky correction is illustrated in fig. 8, where the light grey line
corresponds to the healpy Cℓ estimate before correction, and the dark grey line to the estimate after correction.
Adding in the masking fsky correction, we finally have
Cℓobs = fsky Pℓ2 Bℓ2 Cℓ + ϵℓ ,
(25)
such that we have accounted for the beam, pixel window function, noise, and power reduction due to the mask.
Apodisation and fsky correction might not be enough, though. Some mask types come with unique challenges,
e.g. the point source mask introduces heavy ringing in healpy’s power spectrum estimate, as demonstrated in fig. 9.
This ringing effect can be mitigated by switching to pymaster (see fig. 10), but it comes at the cost of overall larger
uncertainty of the estimate.
17 https://pla.esac.esa.int/
18 Note that the pymaster implementation mixed up the ‘C1’ and ‘C2’ apodisation labels compared to the underlying reference paper by
Grain, Tristram, & Stompor (2009).
19 The HEALPix and healpy routines anafast will require this correction, but a pseudo-C estimator such as NaMaster in general should not.
ℓ
10
Common mask Galactic mask Point source mask
1.0
0.8
0.5◦
0.6
0.4
5.0◦ 0.2
0.0
Figure 7. Masks compared in this analysis, top to bottom increasing in apodisation length, and left to right the “common”
mask (for intensity, there is another common mask specifically for polarisation), the 20 % Galactic mask (leaving 80 % of the
sky unmasked), and the point-source mask (for the Planck lower frequency channels). Yellow corresponds to unmasked regions
whereas dark purple and gradient colours between are masked and apodised regions, respectively.
1.4 1.4
C`masked / C`
C`masked / C`
1.2 1.2
1.0 1.0
0.8 0.8
TT EE
0 1000 2000 3000 4000 5000 6000 0 1000 2000 3000 4000 5000 6000
` `
Figure 8. Mask apodisation effects. Applying a mask to a CMB map can lead to complicated coupling effects so obtaining
the correct power spectrum from the map must be done with care. Here I show the estimated power Cℓmasked from maps masked
with the Planck “common” mask relative to the power spectrum Cℓ from the unmasked map. The left panel shows the results
for the temperature spectrum and the right panel the results for E-mode polarisation. Dividing the observed power by the
unmasked sky fraction fsky is an important step in correctly estimating the overall power, but this does not solve the issue
that at small scales (high ℓ) the power tends to be overestimated. Apodising a mask greatly extends the correctly estimated
multipole range. However, too extreme an apodisation can eventually degrade the estimate again.
11
1.4 TT 1.4 EE
C`masked / C`
C`masked / C`
1.2 1.2
1.0 1.0
0.8 0.8
Figure 9. Same plot as in fig. 8, but now highlighting the effect of different mask types, specifically the difference between
a Galactic mask in the form of a smooth belt around the equator and a point source mask in the form of many disconnected
circular spots (see fig. 7 for a visual comparison). Both masks were apodised before power estimation, and both resulting
Cℓmasked estimates were corrected with the corresponding sky fraction. Overall the power estimates are close to the expected
values, but there is a clear ringing effect in the results with the point source mask.
Power spectrum (from point source mask with 0.5◦ apodisation length, and fsky corrected)
Unmasked healpy.anafast pymaster.compute_full_master
1.4 TT 1.4 EE
C`masked / C`
C`masked / C`
1.2 1.2
1.0 1.0
0.8 0.8
Figure 10. Same plot as in fig. 8, but now highlighting two different power spectrum estimation functions, one from healpy
and the other from pymaster. The latter manages to recover the unmasked Cℓ slightly better, and visibly reduces the ringing
effect from the point source mask.
1. Generate from CAMB or CLASS the desired power-spectrum Cℓ (or download a pre-computed one, e.g. from the
PLA).
2. Convolve the power spectrum with the beam Bℓ and pixel window function Pℓ .
5. Mask the map (ensure that the mask is apodised for certain procedures).
12
From the map (before masking), there are a few possible procedures, such as downgrading the map resolution, which
I now list.
1. Starting from the input map, obtain the aℓm from the map and the mask.
3. Deconvolve by the beam and the pixel window function and reconvolve by the new beam and the new pixel
window function.
4. Downgrade the mask in the same way as the map. The new mask will be extended to account for regions of
the sky that were originally masked leaking into unmasked regions. Choose some threshold for this step and
re-apodise the mask.
5. Generate the new map at the lower resolution, and apply the new downgraded mask.
1. From a masked map you should first remove the dipole and the monopole (these are generally masking effects
and will alter the effectiveness of the final results).
2. Ensure the applied mask was apodised, or apply an apodised mask to the map.
3. Obtain the low-order Cℓ using QML or anafast and the higher orders using a pseudo-Cℓ method such as
NaMaster to control for the effects of the mask. If anafast is used throughout then you must divide by the sky
fraction to obtain the correct amplitude of the underlying Cℓ s.
4. Divide the Cℓ s by the beam and pixel window functions squared. The noise will dominate at the high ℓ compared
to the signal.
To summarize, going from a CMB map to a power spectrum and back should be done with care, but following the
correct procedures will introduce relatively few artefacts, and allow for the effective analysis of the data in either map
space or harmonic space. Any steps taken should be well understood and tested, and any results should be robust
against choices made, such as resolution, beams, masks used, and the methods used to go from the map to harmonic
space and back again.
REFERENCES
Alonso, D., Sanchez, J., Slosar, A., & LSST Dark Energy Gorski, K. M., Wandelt, B. D., Hansen, F. K., Hivon, E., &
Science Collaboration. 2023, Astrophysics Source Code Banday, A. J. 1999, arXiv e-prints, astro,
Library doi: 10.48550/arXiv.astro-ph/9905275
Bilbao-Ahedo, J. D., Barreiro, R. B., Vielva, P., Grain, J., Tristram, M., & Stompor, R. 2009, Physical
Martı́nez-González, E., & Herranz, D. 2021, JCAP, 2021, Review D, 79, 123515, doi: 10.1103/PhysRevD.79.123515
034, doi: 10.1088/1475-7516/2021/07/034 Hivon, E., Górski, K. M., Netterfield, C. B., et al. 2002,
ApJ, 567, 2, doi: 10.1086/338126
—. 2023, Astrophysics Source Code Library
Hu, W., & White, M. 1997, NewA, 2, 323,
Blas, D., Lesgourgues, J., & Tram, T. 2011, Journal of
doi: 10.1016/S1384-1076(97)00022-5
Cosmology and Astroparticle Physics, 2011, 034,
Kamionkowski, M., Kosowsky, A., & Stebbins, A. 1997,
doi: 10.1088/1475-7516/2011/07/034
Phys. Rev. D, 55, 7368, doi: 10.1103/PhysRevD.55.7368
Challinor, A., Chon, G., Colombi, S., et al. 2011,
Kamionkowski, M., & Loeb, A. 1997, Phys. Rev. D, 56,
Astrophysics Source Code Library 4511, doi: 10.1103/PhysRevD.56.4511
Challinor, A., Fosalba, P., Mortlock, D., et al. 2000, Phys. Lesgourgues, J. 2011a, The Cosmic Linear Anisotropy
Rev. D, 62, 123002, doi: 10.1103/PhysRevD.62.123002 Solving System (CLASS) I: Overview.
Górski, K. M., Hivon, E., Banday, A. J., et al. 2005, ApJ, https://arxiv.org/abs/1104.2932
622, 759, doi: 10.1086/427976 —. 2011b. https://arxiv.org/abs/1104.2934
13
Lesgourgues, J., & Tram, T. 2011, Journal of Cosmology Reinecke, M., & Seljebotn, D. S. 2013, A&A, 554, A112,
and Astroparticle Physics, 2011, 032, doi: 10.1051/0004-6361/201321494
doi: 10.1088/1475-7516/2011/09/032 Scott, D., Srednicki, M., & White, M. 1994, ApJ, 421, L5,
doi: 10.1086/187173
Lewis, A., & Challinor, A. 2011, Astrophysics Source Code
Tegmark, M. 1997, Phys. Rev. D, 56, 4514,
Library
doi: 10.1103/PhysRevD.56.4514
Lewis, A., Challinor, A., & Lasenby, A. 2000, ApJ, 538, Vanneste, S., Henrot-Versillé, S., Louis, T., & Tristram, M.
473, doi: 10.1086/309179 2018, Phys. Rev. D, 98, 103526,
Mortlock, D. J., Challinor, A. D., & Hobson, M. P. 2002, doi: 10.1103/PhysRevD.98.103526
MNRAS, 330, 405, Zonca, A., Singer, L., Lenz, D., et al. 2019, Journal of Open
Source Software, 4, 1298, doi: 10.21105/joss.01298
doi: 10.1046/j.1365-8711.2002.05085.x