Skip to content

Commit

Permalink
Adding downstream accuracy CCL params
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Sanchez authored and Javier Sanchez committed Jul 5, 2024
1 parent d393a82 commit 488ae79
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions augur/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ def generate_sacc_and_stats(config):
if cosmo_cfg.get('extra_parameters') is None:
cosmo_cfg['extra_parameters'] = dict()

if 'ccl_accuracy' in config.keys():
# Pass along spline control parameters
if 'spline_params' in config['ccl_accuracy'].keys():
for key in config['ccl_accuracy']['spline_params'].keys():
try:
type_here = type(ccl.spline_params[key])
value = config['ccl_accuracy']['spline_params'][key]
ccl.spline_params[key] = type_here(value)
except KeyError:
print(f'The selected spline keyword `{key}` is not recognized.')
except ValueError:
print(f'The selected value `{value}` could not be casted to `{type_here}`.')
# Pass along GSL control parameters
if 'gsl_params' in config['ccl_accuracy'].keys():
for key in config['ccl_accuracy']['gsl_params'].keys():
try:
type_here = type(ccl.gsl_params[key])
value = config['ccl_accuracy']['gsl_params'][key]
ccl.gsl_params[key] = type_here(value)
except KeyError:
print(f'The selected GSL keyword `{key}` is not recognized.')
except ValueError:
print(f'The selected value `{value}` could not be casted to `{type_here}`.')

try:
cosmo = ccl.Cosmology(**cosmo_cfg)
except (KeyError, TypeError, ValueError) as e:
Expand Down
6 changes: 6 additions & 0 deletions examples/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ cosmo:
# transfer_function : 'eisenstein_hu' # If you want to specify the transfer function you can do so here
# If the transfer function is not specified, it defaults to using CAMB

ccl_accuracy: # Example of a couple of parameters to modify.
spline_params: # You can change here any pyccl.spline_params
K_MAX_SPLINE : 100
gsl_params: # You can change here any pyccl.gsl_params
INTEGRATION_EPSREL: 1e-6

sources: # Sources
nbins : 5
ndens : 10 # in arcmin^-2 (it should be a scalar with the total number density or a list with each bin's)
Expand Down

0 comments on commit 488ae79

Please sign in to comment.