mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Added checks that tolerance value is between 0 and 1 (#2884)
This commit is contained in:
parent
e8f68a0159
commit
b3a2456f2b
2 changed files with 9 additions and 0 deletions
|
|
@ -280,6 +280,9 @@ class Discrete(Univariate):
|
|||
Discrete distribution with low-importance points removed
|
||||
|
||||
"""
|
||||
cv.check_less_than("tolerance", tolerance, 1.0, equality=True)
|
||||
cv.check_greater_than("tolerance", tolerance, 0.0, equality=True)
|
||||
|
||||
# Determine (reversed) sorted order of probabilities
|
||||
intensity = self.p * self.x
|
||||
index_sort = np.argsort(intensity)[::-1]
|
||||
|
|
|
|||
|
|
@ -89,6 +89,12 @@ def test_clip_discrete():
|
|||
d_same = d.clip(1e-6, inplace=True)
|
||||
assert d_same is d
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
d.clip(-1.)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
d.clip(5)
|
||||
|
||||
|
||||
def test_uniform():
|
||||
a, b = 10.0, 20.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue