Skip to content

Commit

Permalink
Removed parameter hardcoding from CCL cosmology initialization in gen…
Browse files Browse the repository at this point in the history
…erate.py.
  • Loading branch information
bruno-moraes committed Jul 4, 2024
1 parent 7c88944 commit 0e44ccd
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions augur/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,22 @@ def generate_sacc_and_stats(config):
"""

config = parse_config(config)

# Initialize cosmology
cosmo_cfg = config['cosmo']
transfer_function = cosmo_cfg.get('transfer_function', 'boltzmann_camb')
extra_parameters = cosmo_cfg.get('extra_parameters', dict())
# Set up ccl.Cosmology object
cosmo = ccl.Cosmology(Omega_b=cosmo_cfg['Omega_b'],
Omega_c=cosmo_cfg['Omega_c'],
n_s=cosmo_cfg['n_s'], sigma8=cosmo_cfg['sigma8'],
h=cosmo_cfg['h'], transfer_function=transfer_function,
extra_parameters=extra_parameters)

if cosmo_cfg.get("transfer_function") is None:
cosmo_cfg['transfer_function'] = 'boltzmann_camb'

if cosmo_cfg.get('extra_parameters') is None:
cosmo_cfg['extra_parameters'] = dict()

try:
cosmo = ccl.Cosmology(**cosmo_cfg)
except (KeyError, TypeError, ValueError) as e:
print('Error in cosmology configuration. Check the config file.')
# Reraise the exception to see the full traceback
raise e

# First we generate the placeholder SACC file with the correct N(z) and ell-binning
# TODO add real-space
Expand Down

0 comments on commit 0e44ccd

Please sign in to comment.