Skip to content

Commit efe173c

Browse files
WantCls=False; tidy; new feedback benchmarks
1 parent f586e1a commit efe173c

30 files changed

+307
-180
lines changed

hmcode/camb_stuff.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
import camb
33

44
def run(zs, Omega_c, Omega_b, Omega_k, h, ns, sigma_8,
5-
m_nu=0., w=-1., wa=0., As=2e-9, norm_sigma8=True, kmax_CAMB=200.,
6-
log10_T_AGN=None, verbose=False):
5+
m_nu=0., w=-1., wa=0., log10_T_AGN=None,
6+
As=2e-9, norm_sigma8=True, kmax_CAMB=200., verbose=False):
77

88
# Sets cosmological parameters in camb to calculate the linear power spectrum
9+
# TODO: Setting 'WantCls=False' in CAMBparams spoils the agreement... why?
910
if log10_T_AGN:
1011
non_linear_model = camb.nonlinear.Halofit(halofit_version="mead2020_feedback",
1112
HMCode_logT_AGN=log10_T_AGN)
1213
else:
1314
non_linear_model = camb.nonlinear.Halofit(halofit_version="mead2020")
14-
pars = camb.CAMBparams(WantCls=False, NonLinearModel=non_linear_model)
15+
pars = camb.CAMBparams(NonLinearModel=non_linear_model)
1516
wb, wc = Omega_b*h**2, Omega_c*h**2
1617

1718
# This function sets standard and helium set using BBN consistency

hmcode/linear_growth.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Third-party imports
22
import numpy as np
3-
import camb
3+
from camb import CAMBdata
44

55
# Parameters
66
a_init = 1e-4 # Initial scale-factor for growth ODE integration
77

8-
def _w(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
8+
def _w(a:float, CAMB_results:CAMBdata, LCDM=False) -> float:
99
'''
1010
Dark energy equation of state for w0, wa models
1111
'''
1212
w0, wa = (-1., 0.) if LCDM else (CAMB_results.Params.DarkEnergy.w, CAMB_results.Params.DarkEnergy.wa)
1313
return w0+(1.-a)*wa
1414

1515

16-
def _X_w(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
16+
def _X_w(a:float, CAMB_results:CAMBdata, LCDM=False) -> float:
1717
'''
1818
Cosmological dark energy density for w0, wa models
1919
'''
2020
w0, wa = (-1., 0.) if LCDM else (CAMB_results.Params.DarkEnergy.w, CAMB_results.Params.DarkEnergy.wa)
2121
return a**(-3.*(1.+w0+wa))*np.exp(-3.*wa*(1.-a))
2222

2323

24-
def _Omega_m(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
24+
def _Omega_m(a:float, CAMB_results:CAMBdata, LCDM=False) -> float:
2525
'''
2626
Evolution of Omgea_m with scale-factor ignoring radiation
2727
'''
@@ -32,7 +32,7 @@ def _Omega_m(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
3232
return Om_m*a**-3/_Hubble2(a, CAMB_results, LCDM)
3333

3434

35-
def _Hubble2(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
35+
def _Hubble2(a:float, CAMB_results:CAMBdata, LCDM=False) -> float:
3636
'''
3737
Squared Hubble parameter ignoring radiation
3838
Massive neutrinos are counted as 'matter'
@@ -47,7 +47,7 @@ def _Hubble2(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
4747
return H2
4848

4949

50-
def _AH(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
50+
def _AH(a:float, CAMB_results:CAMBdata, LCDM=False) -> float:
5151
'''
5252
Acceleration parameter ignoring radiation
5353
Massive neutrinos are counted as 'matter'
@@ -61,7 +61,7 @@ def _AH(a:float, CAMB_results:camb.CAMBdata, LCDM=False) -> float:
6161
return AH
6262

6363

64-
def get_growth_interpolator(CAMB_results:camb.CAMBdata, LCDM=False) -> callable:
64+
def get_growth_interpolator(CAMB_results:CAMBdata, LCDM=False) -> callable:
6565
'''
6666
Solve the linear growth ODE and returns an interpolating function for the solution
6767
LCDM = True forces w = -1 and imposes flatness by modifying the dark-energy density

notebooks/demo.ipynb

Lines changed: 164 additions & 13 deletions
Large diffs are not rendered by default.

notebooks/feedback.ipynb

Lines changed: 7 additions & 31 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_0.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_1.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_10.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_11.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_12.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

tests/benchmarks_feedback/cosmology_13.dat

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)