From 69bdd4e3dd51ac1c5f2d5ac4c847852be7d6c4eb Mon Sep 17 00:00:00 2001 From: Joe Zuntz Date: Tue, 28 Feb 2023 10:35:49 +0000 Subject: [PATCH 1/4] Fix calculation of D(z) --- boltzmann/camb/camb_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boltzmann/camb/camb_interface.py b/boltzmann/camb/camb_interface.py index 80c53af0..6b13bc97 100644 --- a/boltzmann/camb/camb_interface.py +++ b/boltzmann/camb/camb_interface.py @@ -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 From 09f05ef9c777254acc76882aa788fe76bc8bb8ab Mon Sep 17 00:00:00 2001 From: Joe Zuntz Date: Tue, 28 Feb 2023 18:59:55 +0000 Subject: [PATCH 2/4] Update planck tests for new camb --- .github/workflows/ci.yml | 6 ++++-- examples/planck_values.ini | 15 +++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 311084ec..c05f3232 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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} @@ -235,7 +238,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 diff --git a/examples/planck_values.ini b/examples/planck_values.ini index 1376c144..94c4c1f5 100644 --- a/examples/planck_values.ini +++ b/examples/planck_values.ini @@ -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 From 26444a5eccfd1706a57acf129a5583cd1fa17f90 Mon Sep 17 00:00:00 2001 From: Joe Zuntz Date: Tue, 28 Feb 2023 19:16:53 +0000 Subject: [PATCH 3/4] update other numerical values for camb v1.4 --- .github/workflows/ci.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c05f3232..0593fb9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,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/planck.log; fi + if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6043.34' output/planck.log; fi + - name: DES Y3 Class likelihood shell: bash -l {0} @@ -130,7 +136,9 @@ jobs: run: | source cosmosis-configure cosmosis examples/des-y3-shear.ini | tee output/des-y3.log - grep 'Likelihood = 2957.03' 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 = 2957.03' output/planck.log; fi + if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 2957.12' output/planck.log; fi - name: DES Y3 likelihood with Mira Titan @@ -138,14 +146,18 @@ jobs: 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/planck.log; fi + if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6048.1' output/planck.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 + 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/planck.log; fi + if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6049.00' output/planck.log; fi - name: Euclid emulator shell: bash -l {0} From 174929ddbde40f6c274616c91c731b61fc057364 Mon Sep 17 00:00:00 2001 From: Joe Zuntz Date: Tue, 28 Feb 2023 19:26:01 +0000 Subject: [PATCH 4/4] fix file paths --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0593fb9c..499033a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,8 +120,8 @@ jobs: 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 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/planck.log; fi - if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6043.34' output/planck.log; fi + 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 @@ -135,10 +135,10 @@ jobs: shell: bash -l {0} run: | source cosmosis-configure - cosmosis examples/des-y3-shear.ini | tee 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/planck.log; fi - if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 2957.12' output/planck.log; fi + 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 @@ -147,17 +147,17 @@ jobs: source cosmosis-configure cosmosis examples/des-y3-mira-titan.ini | tee 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/planck.log; fi - if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6048.1' output/planck.log; fi + 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 + 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/planck.log; fi - if [ "$OLD_CAMB" == "False" ]; then grep 'Likelihood = 6049.00' output/planck.log; fi + 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}