Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dsps/metallicity/tests/test_umzr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
"""
""" """

import numpy as np
from jax import random as jran
Expand Down Expand Up @@ -101,3 +100,14 @@ def test_default_umzr_params():
gen = zip(umzr.DEFAULT_MZR_U_PARAMS, umzr.DEFAULT_MZR_U_PARAMS._fields)
for u_param, key in gen:
assert np.all(np.isfinite(u_param)), f"Parameter `{key}` is NaN"


def test_default_values_within_bounds():
values = umzr.DEFAULT_MZR_PARAMS._asdict()
bounds = umzr.MZR_PBOUNDS._asdict()

assert len(values) == len(bounds)

for param_name, val in values.items():
low, high = bounds[param_name]
assert low <= val <= high
4 changes: 2 additions & 2 deletions dsps/metallicity/umzr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Mass-metallicity-redshift scaling relation with unbounding behavior
"""
"""Mass-metallicity-redshift scaling relation with unbounding behavior"""

from collections import OrderedDict, namedtuple

Expand Down Expand Up @@ -67,6 +66,7 @@
MZRUParams = namedtuple("MZRUParams", _MZR_UPNAMES)

DEFAULT_MZR_PARAMS = MZRParams(**DEFAULT_MZR_PDICT)
MZR_PBOUNDS = MZRParams(**MZR_PBDICT)


def get_ran_t0_params(ran_key, bounds_pdict=MZR_T0_PBDICT):
Expand Down
Loading