Skip to content

Commit

Permalink
Merge pull request #804 from LSSTDESC/omega_k_check
Browse files Browse the repository at this point in the history
Added a check for the value of Omega_k.
  • Loading branch information
tassia-ferreira committed Jul 27, 2020
2 parents 0c013ca + 3c26502 commit 385fff0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyccl/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ def _build_parameters(
mu_0=None, sigma_0=None, z_mg=None, df_mg=None, Omega_g=None):
"""Build a ccl_parameters struct"""

# Check to make sure Omega_k is within reasonable bounds.
if Omega_k is not None and Omega_k < -1.0135:
raise ValueError("Omega_k must be more than -1.0135.")

# Set nz_mg (no. of redshift bins for modified growth fns.)
if z_mg is not None and df_mg is not None:
# Get growth array size and do sanity check
Expand Down
6 changes: 6 additions & 0 deletions pyccl/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,9 @@ def test_parameters_read_write():
IOError,
params.read_yaml,
filename=temp_file_name+"/nonexistent_directory/params.yml")


def test_omega_k():
""" Check that the value of Omega_k is within reasonable bounds. """
assert_raises(ValueError, ccl.Cosmology, Omega_c=0.25, Omega_b=0.05, h=0.7,
A_s=2.1e-9, n_s=0.96, Omega_k=-2)

0 comments on commit 385fff0

Please sign in to comment.