CAMB: issue calculating H0 with set_w_a_table()
Posted: January 21 2021
I seem to be having some issue using the set_w_a_table() function in the dark energy models. For example, if I use the DarkEnergyPPF model with thetastar fixed then I am able to obtain an H0 value different from that in the LCDM base model. But when I reproduce the DarkEnergyPPF model using the set_w_a_table() function and keeping thetastar fixed I am not able to reproduce the same H0 value. Instead, the H0 value is that of the LCDM model.
Here is the python3 code demonstrating the problem. It is written using CAMB 1.3.0.
Values for [math] and [math] were chosen to highlight the issue, but the problem persists still at more reasonable values. The resulting H0 values for each model are
while the resulting dark energy densities and power spectrum are
The tabulated PPF dark energy model does not seem to reproduce the results of the built in DarkEnergyPPF model. If anyone familiar with the process could spot an error that may fix this problem, do please let me know.
Here is the python3 code demonstrating the problem. It is written using CAMB 1.3.0.
Code: Select all
import sys, platform, os
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
camb_path = os.path.realpath(os.path.join(os.getcwd(),'..'))
sys.path.insert(0,camb_path)
import camb
from camb import model, initialpower
from camb.dark_energy import DarkEnergyPPF
zs = np.logspace(-5, 5, 1000)
thetastar = 0.01044341764253
# LCDM base model
params = camb.set_params(ombh2=0.022, omch2=0.122, thetastar=thetastar)
results_LCDM = camb.get_results(params)
cl_LCDM = results_LCDM.get_lensed_scalar_cls(CMB_unit = 'muK')
# DarkEnergyPPF
params = camb.set_params(ombh2=0.022, omch2=0.122, w=-0.5, wa=0.4,
dark_energy_model='DarkEnergyPPF', thetastar=thetastar)
results_PPF = camb.get_results(params)
cl_PPF = results_PPF.get_lensed_scalar_cls(CMB_unit = 'muK')
# DarkEnergyPPF using w(a) table
a = np.logspace(-5, 0, 1000)
w = -0.5 + 0.4*(1-a)
params = camb.set_params(ombh2=0.022, omch2=0.122, thetastar=thetastar)
params.DarkEnergy = DarkEnergyPPF()
params.DarkEnergy.set_w_a_table(a, w)
results_PPFtabulated = camb.get_background(params)
results_PPFtabulated.calc_power_spectra(params)
cl_PPFtabulated = results_PPFtabulated.get_lensed_scalar_cls(CMB_unit='muK')
print('LCDM: H0 = ', results_LCDM.Params.H0)
print('PPF DE: H0 = ', results_PPF.Params.H0)
print('tabulated PPF DE: H0 = ', results_PPFtabulated.Params.H0)
fig, axs = plt.subplots(2, 1, figsize=(10,8))
axs[0].semilogx(zs, results_LCDM.get_Omega('de', z=zs), c='C0')
axs[0].semilogx(zs, results_PPF.get_Omega('de', z=zs), c='C1')
axs[0].semilogx(zs, results_PPFtabulated.get_Omega('de', z=zs), c='C2')
axs[0].set_xlim([1e1,1e5])
axs[0].set_xlabel(r'$z$')
axs[0].set_ylabel(r'$\Omega_{\rm de}$')
axs[1].plot(cl_LCDM[2:,0], c='C0')
axs[1].plot(cl_PPF[2:,0], c='C1')
axs[1].plot(cl_PPFtabulated[2:,0], c='C2')
axs[1].set_xlabel(r'$\ell$')
axs[1].set_ylabel(r'$D_l [\mu {\rm D}^2]$')
axs[1].legend(['$\Lambda$CDM','PPF','tabulated PPF'])
plt.show()
Code: Select all
LCDM: H0 = 67.42062819302447
PPF DE: H0 = 49.53005264854277
tabulated PPF DE: H0 = 67.42062819302447