Skip to content

Commit 0f7f014

Browse files
authored
Merge branch 'joezuntz:main' into main
2 parents 2ebc3cf + 7d7e978 commit 0f7f014

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1805
-4169
lines changed

boltzmann/camb/camb_interface.py

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def setup(options):
122122
config['want_zdrag'] = mode != MODE_BG
123123
config['want_zstar'] = config['want_zdrag']
124124

125+
more_config['recombination_model'] = options.get_string(opt, 'recombination_model', default='recfast')
126+
125127
more_config['want_chistar'] = options.get_bool(opt, 'want_chistar', default=True)
126128
more_config['n_logz'] = options.get_int(opt, 'n_logz', default=0)
127129
more_config['zmax_logz'] = options.get_double(opt, 'zmax_logz', default = 1100.)
@@ -157,7 +159,7 @@ def setup(options):
157159
raise ValueError("halofit_version must be one of : {}. You put: {}".format(known_halofit_versions, halofit_version))
158160

159161
more_config["accuracy_params"] = get_optional_params(options, opt,
160-
['AccuracyBoost', 'lSampleBoost', 'lAccuracyBoost', 'DoLateRadTruncation'])
162+
['AccuracyBoost', 'lSampleBoost', 'lAccuracyBoost', 'DoLateRadTruncation', 'min_l_logl_sampling'])
161163
# 'TimeStepBoost', 'BackgroundTimeStepBoost', 'IntTolBoost',
162164
# 'SourcekAccuracyBoost', 'IntkAccuracyBoost', 'TransferkBoost',
163165
# 'NonFlatIntAccuracyBoost', 'BessIntBoost', 'LensingBoost',
@@ -205,35 +207,39 @@ def setup(options):
205207
# during the execute function
206208

207209
def extract_recombination_params(block, config, more_config):
208-
default_recomb = camb.recombination.Recfast()
209-
210-
min_a_evolve_Tm = block.get_double('recfast', 'min_a_evolve_Tm', default=default_recomb.min_a_evolve_Tm)
211-
RECFAST_fudge = block.get_double('recfast', 'RECFAST_fudge', default=default_recomb.RECFAST_fudge)
212-
RECFAST_fudge_He = block.get_double('recfast', 'RECFAST_fudge_He', default=default_recomb.RECFAST_fudge_He)
213-
RECFAST_Heswitch = block.get_int('recfast', 'RECFAST_Heswitch', default=default_recomb.RECFAST_Heswitch)
214-
RECFAST_Hswitch = block.get_bool('recfast', 'RECFAST_Hswitch', default=default_recomb.RECFAST_Hswitch)
215-
AGauss1 = block.get_double('recfast', 'AGauss1', default=default_recomb.AGauss1)
216-
AGauss2 = block.get_double('recfast', 'AGauss2', default=default_recomb.AGauss2)
217-
zGauss1 = block.get_double('recfast', 'zGauss1', default=default_recomb.zGauss1)
218-
zGauss2 = block.get_double('recfast', 'zGauss2', default=default_recomb.zGauss2)
219-
wGauss1 = block.get_double('recfast', 'wGauss1', default=default_recomb.wGauss1)
220-
wGauss2 = block.get_double('recfast', 'wGauss2', default=default_recomb.wGauss2)
221-
222-
recomb = camb.recombination.Recfast(
223-
min_a_evolve_Tm = min_a_evolve_Tm,
224-
RECFAST_fudge = RECFAST_fudge,
225-
RECFAST_fudge_He = RECFAST_fudge_He,
226-
RECFAST_Heswitch = RECFAST_Heswitch,
227-
RECFAST_Hswitch = RECFAST_Hswitch,
228-
AGauss1 = AGauss1,
229-
AGauss2 = AGauss2,
230-
zGauss1 = zGauss1,
231-
zGauss2 = zGauss2,
232-
wGauss1 = wGauss1,
233-
wGauss2 = wGauss2,
234-
)
210+
if more_config['recombination_model'] == 'recfast':
211+
default_recomb = camb.recombination.Recfast()
212+
213+
min_a_evolve_Tm = block.get_double('recfast', 'min_a_evolve_Tm', default=default_recomb.min_a_evolve_Tm)
214+
RECFAST_fudge = block.get_double('recfast', 'RECFAST_fudge', default=default_recomb.RECFAST_fudge)
215+
RECFAST_fudge_He = block.get_double('recfast', 'RECFAST_fudge_He', default=default_recomb.RECFAST_fudge_He)
216+
RECFAST_Heswitch = block.get_int('recfast', 'RECFAST_Heswitch', default=default_recomb.RECFAST_Heswitch)
217+
RECFAST_Hswitch = block.get_bool('recfast', 'RECFAST_Hswitch', default=default_recomb.RECFAST_Hswitch)
218+
AGauss1 = block.get_double('recfast', 'AGauss1', default=default_recomb.AGauss1)
219+
AGauss2 = block.get_double('recfast', 'AGauss2', default=default_recomb.AGauss2)
220+
zGauss1 = block.get_double('recfast', 'zGauss1', default=default_recomb.zGauss1)
221+
zGauss2 = block.get_double('recfast', 'zGauss2', default=default_recomb.zGauss2)
222+
wGauss1 = block.get_double('recfast', 'wGauss1', default=default_recomb.wGauss1)
223+
wGauss2 = block.get_double('recfast', 'wGauss2', default=default_recomb.wGauss2)
224+
225+
recomb = camb.recombination.Recfast(
226+
min_a_evolve_Tm = min_a_evolve_Tm,
227+
RECFAST_fudge = RECFAST_fudge,
228+
RECFAST_fudge_He = RECFAST_fudge_He,
229+
RECFAST_Heswitch = RECFAST_Heswitch,
230+
RECFAST_Hswitch = RECFAST_Hswitch,
231+
AGauss1 = AGauss1,
232+
AGauss2 = AGauss2,
233+
zGauss1 = zGauss1,
234+
zGauss2 = zGauss2,
235+
wGauss1 = wGauss1,
236+
wGauss2 = wGauss2,
237+
)
238+
239+
#Not yet supporting CosmoRec by default, but not too hard to compile in camb yourself if needed.
240+
elif more_config['recombination_model'] == 'cosmorec':
235241

236-
#Not yet supporting CosmoRec, but not too hard if needed.
242+
recomb = camb.recombination.CosmoRec()
237243

238244
return recomb
239245

@@ -579,9 +585,11 @@ def save_matter_power(r, block, more_config):
579585
# Note that the transfer function has different k range and precision as
580586
# there is no interpolating function for it in CAMB.
581587
# We might consider creating an interpolator ...
588+
# Note here, that like in the returned sigma_8 and fsigma_8, the redshifts here are reversed
589+
# thus for a redshift=0 transfer function we ask for the last element
582590
section_name_transfer = matter_power_section_names[transfer_type] + "_transfer_func"
583-
transfer_func = r.get_matter_transfer_data().transfer_z(tt)
584-
k_transfer_func = r.get_matter_transfer_data().transfer_z("k/h")
591+
transfer_func = r.get_matter_transfer_data().transfer_z(tt, -1)
592+
k_transfer_func = r.get_matter_transfer_data().transfer_z("k/h", -1)
585593
block.put_double_array_1d(section_name_transfer, "k_h", k_transfer_func)
586594
block.put_double_array_1d(section_name_transfer, "t_k", transfer_func)
587595

boltzmann/camb/module.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ params:
219219
meaning: Whether to use the tau parametrization of reionization instead of z.
220220
type: bool
221221
default: true
222+
recombination_model:
223+
meaning: Which model to use for recombination physics. Choose from recfast, cosmorec
224+
type: str
225+
default: "recfast"
222226
DoLateRadTruncation:
223227
meaning: Whether to use smooth approx to radiation perturbations after decoupling
224228
on small scales, saving evolution of irrelevant osciallatory multipole

examples/act-dr6-lite.ini

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ save_dir=output/act
99
fatal_errors=T
1010

1111
[output]
12-
filename = output/act-lite.txt
12+
filename = output/act-lite-default.txt
1313

1414
[maxlike]
1515
maxiter = 1000
1616
tolerance = 0.01
1717
max_posterior = T
18+
output_ini = output/act-lite-default-maxlike.ini
1819

1920
[nautilus]
2021
n_live = 2000
2122

23+
[emcee]
24+
walkers = 64
25+
samples = 2000
26+
nsteps = 10
27+
28+
[grid]
29+
nsample_dimension = 30
2230

2331
[pipeline]
2432
; these names refer to sections later in the file:
@@ -27,6 +35,7 @@ values = examples/act-lite-values.ini
2735
priors = examples/act-lite-priors.ini
2836
debug=T
2937
timing=F
38+
extra_output = cosmological_parameters/sigma_8 cosmological_parameters/H_0
3039

3140

3241
[act]
@@ -43,11 +52,23 @@ cosmomc_theta = T
4352

4453

4554
[camb]
55+
; These accuracy settings are required to reproduce the published result
56+
; NOTE: cosmorec is also required for accurate reproduction, but not included in
57+
; supplied version of CAMB (so you should compile your own following instructions
58+
; in the CAMB documentation).
4659
file = boltzmann/camb/camb_interface.py
4760
mode = cmb
61+
kmax = 10.
62+
k_per_logint = 130
63+
nonlinear = true
64+
lens_potential_accuracy = 8
65+
lens_margin = 2050
66+
lAccuracyBoost = 1.2
67+
min_l_logl_sampling = 6000
68+
DoLateRadTruncation = false
69+
recombination_model = recfast ; cosmorec required for accurate reproduction
4870
lmax = 8500 ;max ell to use for cmb calculation
4971
feedback=0 ;amount of output to print
50-
AccuracyBoost=1.1 ;CAMB accuracy boost parameter
5172
do_tensors = True ;include tensor modes
5273
do_lensing = true ;lensing is required w/ Planck data
5374
NonLinear = lens

examples/act-dr6.ini

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ save_dir=output/act
99
fatal_errors=T
1010

1111
[output]
12-
filename = output/act.txt
12+
filename = output/act-default.txt
1313

1414
[maxlike]
1515
maxiter = 1000
@@ -19,6 +19,15 @@ max_posterior = T
1919
[nautilus]
2020
n_live = 2000
2121

22+
[maxlike]
23+
maxiter = 1000
24+
tolerance = 0.01
25+
max_posterior = T
26+
27+
[emcee]
28+
walkers = 128
29+
samples = 2000
30+
nsteps = 100
2231

2332
[pipeline]
2433
; these names refer to sections later in the file:
@@ -27,6 +36,7 @@ values = examples/act-values.ini
2736
priors = examples/act-priors.ini
2837
debug=T
2938
timing=F
39+
extra_output = cosmological_parameters/sigma_8 cosmological_parameters/H_0
3040

3141

3242
[act]
@@ -43,14 +53,26 @@ cosmomc_theta = T
4353

4454

4555
[camb]
56+
57+
; These accuracy settings are required to reproduce the published result
58+
; NOTE: cosmorec is also required for accurate reproduction, but not included in
59+
; supplied version of CAMB (so you should compile your own following instructions
60+
; in the CAMB documentation).
4661
file = boltzmann/camb/camb_interface.py
4762
mode = cmb
63+
kmax = 10.
64+
k_per_logint = 130
65+
nonlinear = true
66+
lens_potential_accuracy = 8
67+
lens_margin = 2050
68+
lAccuracyBoost = 1.2
69+
min_l_logl_sampling = 6000
70+
DoLateRadTruncation = false
71+
recombination_model = recfast ; cosmorec required for accurate reproduction
4872
lmax = 8500 ;max ell to use for cmb calculation
4973
feedback=0 ;amount of output to print
50-
AccuracyBoost=1.1 ;CAMB accuracy boost parameter
5174
do_tensors = True ;include tensor modes
5275
do_lensing = true ;lensing is required w/ Planck data
5376
NonLinear = lens
5477
accurate_massive_neutrino_transfers = T
55-
theta_H0_range = "20 100"
56-
78+
theta_H0_range = "20 100"

examples/act-lite-priors.ini

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[act_params]
2-
A_act = gaussian 1.0 0.1
3-
P_act = gaussian 1.0 0.1
2+
A_act = gaussian 1.0 0.003
3+
P_act = gaussian 1.0 0.1
4+
5+
[cosmological_parameters]
6+
tau = gaussian 0.0544 0.0073

examples/act-priors.ini

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ cal_dr6_pa6_f150 = gaussian 1.0 0.0024
1717

1818
[cmb_foreground_params]
1919
; TT
20-
a_tSZ = uniform 3.0 3.6
21-
a_kSZ = uniform 1.4 1.8
22-
a_p = uniform 6.2 7.6
23-
beta_p = uniform 1.8 2.2
24-
a_c = uniform 4.4 5.4
25-
beta_c = uniform 2.0 2.4
26-
a_s = uniform 2.8 3.4
27-
a_gtt = gaussian 2.79 0.45
20+
a_tSZ = uniform 0 inf
21+
a_kSZ = uniform 0 inf
22+
a_p = uniform 0 inf
23+
;beta_p = uniform 1.8 2.2
24+
a_c = uniform 0 inf
25+
;beta_c = uniform 2.0 2.4
26+
a_s = uniform 0 inf
27+
a_gtt = gaussian 7.95 0.32
2828
xi = uniform 0 0.2
29-
T_d = uniform 8.6 10.6
29+
;T_d = uniform 8.6 10.6
3030

3131
; TE
32-
a_gte = gaussian 0.36 0.04
33-
a_pste = uniform -1 1
32+
a_gte = gaussian 0.423 0.03
33+
;a_pste = uniform -1 1
3434

3535
; EE
36-
a_gee = gaussian 0.13 0.03
36+
a_gee = gaussian 0.1681 0.017
3737
a_psee = uniform 0 inf

examples/act-values.ini

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,42 @@ w = -1.0 ;equation of state of dark energy
2828
wa = 0.0 ;equation of state of dark energy (redshift dependency)
2929

3030
[act_params]
31-
bandint_shift_dr6_pa4_f220 = -14.4 0.0 14.4
32-
bandint_shift_dr6_pa5_f090 = -4.0 0.0 4.0
33-
bandint_shift_dr6_pa5_f150 = -5.2 0.0 5.2
34-
bandint_shift_dr6_pa6_f090 = -4.8 0.0 4.8
35-
bandint_shift_dr6_pa6_f150 = -4.4 0.0 4.4
36-
calG_all = 0.988 1.0 1.012
31+
bandint_shift_dr6_pa4_f220 = -25.0 0.0 25.0
32+
bandint_shift_dr6_pa5_f090 = -10.0 0.0 10.0
33+
bandint_shift_dr6_pa5_f150 = -10.0 0.0 10.0
34+
bandint_shift_dr6_pa6_f090 = -10.0 0.0 10.0
35+
bandint_shift_dr6_pa6_f150 = -10.0 0.0 10.0
36+
calG_all = 0.9 1.0 1.1
3737
calE_dr6_pa4_f220 = 1.0
3838
calE_dr6_pa5_f090 = 0.9 1.0 1.1
3939
calE_dr6_pa5_f150 = 0.9 1.0 1.1
4040
calE_dr6_pa6_f090 = 0.9 1.0 1.1
4141
calE_dr6_pa6_f150 = 0.9 1.0 1.1
42-
cal_dr6_pa4_f220 = 0.96 1.0 1.04
43-
cal_dr6_pa5_f090 = 0.96 1.0 1.04
44-
cal_dr6_pa5_f150 = 0.96 1.0 1.04
45-
cal_dr6_pa6_f090 = 0.96 1.0 1.04
46-
cal_dr6_pa6_f150 = 0.96 1.0 1.04
42+
cal_dr6_pa4_f220 = 0.9 1.0 1.1
43+
cal_dr6_pa5_f090 = 0.9 1.0 1.1
44+
cal_dr6_pa5_f150 = 0.9 1.0 1.1
45+
cal_dr6_pa6_f090 = 0.9 1.0 1.1
46+
cal_dr6_pa6_f150 = 0.9 1.0 1.1
4747

4848
[cmb_foreground_params]
49-
a_tSZ = 3.0 3.3 3.6
50-
a_kSZ = 1.4 1.6 1.8
51-
a_p = 6.2 6.9 7.6
52-
beta_p = 1.8 2.0 2.2
53-
a_c = 4.4 4.9 5.4
54-
beta_c = 2.0 2.2 2.4
55-
a_s = 2.8 3.0999999999999996 3.4
56-
a_gtt = 0.99 2.79 4.59
57-
xi = 0 0.1 0.2
58-
T_d = 8.6 9.6 10.6
49+
a_tSZ = 0.0 3.4 10.0
50+
a_kSZ = 0.0 1.5 10.0
51+
a_p = 0.0 7.7 50.0
52+
beta_p = 0.0 1.9 5.0
53+
a_c = 0.0 3.6 50.0
54+
beta_c = 0.0 1.9 5.0 ; lambda beta_p: beta_p
55+
a_s = 0.0 2.8 50.0
56+
a_gtt = 0.0 8.0 50.0
57+
xi = 0.0 0.09 0.2
58+
T_d = 9.6
5959
alpha_dT = -0.6
6060
alpha_p = 1.0
61-
alpha_tSZ = 0.0
62-
a_gte = 0.19999999999999998 0.36 0.52
63-
a_pste = -1 0.0 1
61+
alpha_tSZ = -5.0 -0.6 5.0
62+
a_gte = 0.0 0.42 1.0
63+
a_pste = -1.0 -0.026 1.0
6464
alpha_dE = -0.4
65-
a_gee = 0.010000000000000009 0.13 0.25
66-
a_psee = 0 0.1 0.2
65+
a_gee = 0.0 0.17 1.0
66+
a_psee = 0 0.02 1.0
6767
alpha_dE = -0.4
6868

6969

examples/planck_lite.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ use_low_ell_bins = T
2222
spectra = TTTEEE
2323
year = 2018
2424

25+
; you can use these parameters to set the maximum ell for each spectrum:
26+
; ell_max_tt = 500
27+
; ell_max_te = 500
28+
; ell_max_ee = 500
2529

2630
; The consistency module translates between our chosen parameterization
2731
; and any other that modules in the pipeline may want (e.g. camb)

likelihood/act-dr6-lite/act_dr6_lite_interface.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
try:
22
import act_dr6_cmbonly
33
except ImportError:
4-
raise RuntimeError('The act_dr6_cmbonly python module is required for the act_dr6_lite likelihood.')
4+
raise RuntimeError('The act_dr6_cmbonly python module is required for the act_dr6_lite likelihood. It can be obtained from https://github.com/ACTCollaboration/DR6-ACT-lite')
55
from cosmosis.datablock import names
66
cosmo = names.cosmological_parameters
77
import numpy as np
@@ -25,9 +25,9 @@ def execute(block, config):
2525
act = config
2626

2727
cl_dict = {
28-
"tt": block[names.cmb_cl, 'tt'],
29-
"te": block[names.cmb_cl, 'te'],
30-
"ee": block[names.cmb_cl, 'ee'],
28+
"tt": np.append(np.array([0,0]), block[names.cmb_cl, 'tt']),
29+
"te": np.append(np.array([0,0]), block[names.cmb_cl, 'te']),
30+
"ee": np.append(np.array([0,0]), block[names.cmb_cl, 'ee']),
3131
}
3232

3333
nuisance = {}

0 commit comments

Comments
 (0)