Skip to content

Commit

Permalink
Merge pull request #56 from joezuntz/camb-D-fix
Browse files Browse the repository at this point in the history
Fix calculation of D(z)
  • Loading branch information
joezuntz authored Feb 28, 2023
2 parents 093b0a3 + 174929d commit 7d87878
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ jobs:
./examples/get-planck-data.sh
# And that the pipeline runs afterwards
cosmosis examples/planck.ini | tee output/planck.log
grep 'Likelihood = -6288.61' output/planck.log
OLD_CAMB=$(python -c 'import camb;vs=camb.__version__.split(".");print(float(vs[0]+"."+vs[1])<1.4)')
if [ "$OLD_CAMB" == "True" ]; then grep 'Likelihood = -1441.30' output/planck.log; fi
if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = -1441.46' output/planck.log; fi
- name: Class Planck
shell: bash -l {0}
Expand Down Expand Up @@ -99,21 +102,27 @@ jobs:
run: |
source cosmosis-configure
cosmosis examples/des-y1.ini | tee output/des-y1.log
grep 'Likelihood = 5237.37' output/des-y1.log
# unchanged in camb 1.4
grep 'Likelihood = 5237.3' output/des-y1.log
- name: DES Y1 likelihood with cl_to_corr
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis examples/des-y1.ini -p 2pt_shear.file=./shear/cl_to_corr/cl_to_corr.py 2pt_shear.corr_type=xi | tee output/des-y1.log
# unchanged in camb 1.4
grep 'Likelihood = 5237.3' output/des-y1.log
- name: DES Y3 likelihood
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis examples/des-y3.ini -p pk_to_cl_gg.save_kernels=T pk_to_cl.save_kernels=T | tee output/des-y3.log
grep 'Likelihood = 6043.23' output/des-y3.log
OLD_CAMB=$(python -c 'import camb;vs=camb.__version__.split(".");print(float(vs[0]+"."+vs[1])<1.4)')
if [ "$OLD_CAMB" == "True" ]; then grep 'Likelihood = 6043.23' output/des-y3.log; fi
if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6043.34' output/des-y3.log; fi
- name: DES Y3 Class likelihood
shell: bash -l {0}
Expand All @@ -126,23 +135,29 @@ jobs:
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis examples/des-y3-shear.ini | tee output/des-y3.log
grep 'Likelihood = 2957.03' output/des-y3.log
cosmosis examples/des-y3-shear.ini | tee output/des-y3-shear.log
OLD_CAMB=$(python -c 'import camb;vs=camb.__version__.split(".");print(float(vs[0]+"."+vs[1])<1.4)')
if [ "$OLD_CAMB" == "True" ]; then grep 'Likelihood = 2957.03' output/des-y3-shear.log; fi
if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 2957.12' output/des-y3-shear.log; fi
- name: DES Y3 likelihood with Mira Titan
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis examples/des-y3-mira-titan.ini | tee output/des-y3-mt.log
grep 'Likelihood = 6048.0' output/des-y3-mt.log
OLD_CAMB=$(python -c 'import camb;vs=camb.__version__.split(".");print(float(vs[0]+"."+vs[1])<1.4)')
if [ "$OLD_CAMB" == "True" ]; then grep 'Likelihood = 6048.0' output/des-y3-mt.log; fi
if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6048.1' output/des-y3-mt.log; fi
- name: DES Y3 likelihood with Mead nonlinear
shell: bash -l {0}
run: |
source cosmosis-configure
cosmosis examples/des-y3.ini -v halo_model_parameters.logT_AGN=8.2 -p camb.halofit_version=mead2020_feedback | tee output/des-y3.log
grep 'Likelihood = 6049.94' output/des-y3.log
cosmosis examples/des-y3.ini -v halo_model_parameters.logT_AGN=8.2 -p camb.halofit_version=mead2020_feedback | tee output/des-y3-mead.log
OLD_CAMB=$(python -c 'import camb;vs=camb.__version__.split(".");print(float(vs[0]+"."+vs[1])<1.4)')
if [ "$OLD_CAMB" == "True" ]; then grep 'Likelihood = 6049.94' output/des-y3-mead.log; fi
if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6049.00' output/des-y3-mead.log; fi
- name: Euclid emulator
shell: bash -l {0}
Expand Down Expand Up @@ -235,7 +250,6 @@ jobs:
cosmosis demos/demo2.ini
cosmosis-postprocess demos/demo2.ini -o output/demo2
test -f output/demo2/comoving_distance.png
python .github/ci-checks.py
- name: Demo 9 Low-Resolution Multinest
Expand Down
2 changes: 1 addition & 1 deletion boltzmann/camb/camb_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def compute_growth_factor(r, block, P_tot, k, z, more_config):

# Evaluate it at the smallest k, for the
kmin = k.min()
P_kmin = P_tot(z, kmin)
P_kmin = P_tot.P(z, kmin)

D = np.sqrt(P_kmin / P_kmin[0]).squeeze()
return D
Expand Down
15 changes: 7 additions & 8 deletions examples/planck_values.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@
a_planck = 1.0

[cosmological_parameters]
h0 = 0.6726 ;H0 (km/s/Mpc)/100.0km/s/Mpc
omega_m = 0.3141 ;density fraction for matter today
omega_b = 0.04 ;density fraction for baryons today
h0 = 0.6732 ;H0 (km/s/Mpc)/100.0km/s/Mpc
omega_k = 0.0 ;spatial curvature
ombh2 = 0.022383
omch2 = 0.12011

;neutrinos
mnu = 0.06
nnu = 3.046
num_massive_neutrinos = 1


;helium
yhe = 0.245341 ;helium mass fraction

;reionization
tau = 0.08 ;reionization optical depth
tau = 0.0543 ;reionization optical depth

;inflation Parameters
n_s = 0.96 ;scalar spectral index
A_s = 2.1e-9 ;scalar spectrum primordial amplitude
n_s = 0.96605 ;scalar spectral index
log1e10As = 3.0448 ; structure amplitude parameter
k_s = 0.05 ;Power spectrum pivot scale
n_run = 0.0 ;running of scalar spectrum
r_t = 0.2 ;tensor to scalar ratio
r_t = 0.0 ;tensor to scalar ratio
n_t = 0.0 ;tensor spectral index

;dark energy equation of state
Expand Down

0 comments on commit 7d87878

Please sign in to comment.