@@ -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
207209def 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
0 commit comments