pythonhealpy

healpy anafast leads to large Cl's


I'm using HEALPy's anafast to extract the Cl's from Planck maps, either the data map [1], or the simulation maps. It seems that even after I apply their Intensity common mask [2], I got a power spectrum that's about five times larger than their release [3].

# extract Cl's
filename = 'path/to/COM_CMB_IQU-commander_2048_R3.00_full.fits'
test_map = read_map(filename)

path = 'path/to/COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits'
mask = hp.read_map(path)
map_masked = hp.ma(test_map)
map_masked.mask = np.logical_not(mask)

test_cls_meas_frommap = anafast(map_masked, lmax=3000)

# load up Planck meas powerspectrum
path = '/path/to/powerspectrum'
T2 = 10**12*2.7255**2  # in muK^2
datalist = {
    'tt': 'COM_PowerSpect_CMB-TT-binned_R3.01.txt',
    'ee': 'COM_PowerSpect_CMB-EE-binned_R3.02.txt',
    'te': 'COM_PowerSpect_CMB-TE-binned_R3.02.txt'
}
targ = os.path.join(path, datalist['tt'])
res = cmb.load_meas(targ)
ll_meas = res[:, 0]
test_cls_meas = res[:, 1]/ll_meas/(ll_meas+1)*2.*np.pi/T2

# output
plt.subplots()
plt.plot(ll_meas, ll_meas*(ll_meas+1.)*test_cls_meas*T2/2./np.pi, '--', alpha=0.6, label='Planck 2018 PS release')
plt.plot(ll, ll*(ll+1.)*test_cls_meas_frommap*T2/2./np.pi, '--', alpha=0.6, label='Planck 2018 PS from Data Map')
plt.xlabel(r'$\ell$')
plt.ylabel(r'$D_\ell$')
#plt.xscale('log')
plt.legend(loc='best')

On the other hand, if I use synfast to synthesize a map myself, then extract the power spectrum using anafast, I can verify that I got the input power spectrum. I wonder if there are any potential pitfalls that could lead to the mismatch of power spectrum computation compared to the Planck way?

Data source:

[1] data map: (wget -O COM_CMB_IQU-commander_2048_R3.00_full "pla.esac.esa.int/pla-sl/data-action?MAP.MAP_OID=13470")

[2] mask map: (wget -O COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits "http://pla.esac.esa.int/pla/aio/product-action?MAP.MAP_ID=COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits")

[3] official power spectrum: (wget -O COM_PowerSpect_CMB-TT-binned_R3.01.txt "http://pla.esac.esa.int/pla/aio/product-action?COSMOLOGY.FILE_ID=COM_PowerSpect_CMB-TT-binned_R3.01.txt")


Solution

  • there are a couple of issues in your computation:

    So this should work:

    cmb_binned_spectrum = np.loadtxt('COM_PowerSpect_CMB-TT-binned_R3.01.txt')
    k2muK = 1e6
    plt.plot(cmb_binned_spectrum[:,0], cmb_binned_spectrum[:,1], '--', alpha=1, label='Planck 2018 PS release')
    plt.plot(ll, ll*(ll+1.)*test_cls_meas_frommap*k2muK**2/2./np.pi / sky_fraction, '--', alpha=0.6, label='Planck 2018 PS from Data Map')
    plt.xlabel(r'$\ell$')
    plt.ylabel(r'$D_\ell~[\mu K^2]$')
    plt.grid()
    plt.legend(loc='best')
    

    I explained it and gone through all the steps in this notebook: https://zonca.dev/2021/02/compute-planck-spectra-healpy-anafast.html