mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
PowerLaw raises an error if sampling interval contains negative values (#3542)
This commit is contained in:
parent
ca4295748d
commit
c7175289eb
1 changed files with 9 additions and 0 deletions
|
|
@ -480,6 +480,9 @@ class PowerLaw(Univariate):
|
|||
"""
|
||||
|
||||
def __init__(self, a: float = 0.0, b: float = 1.0, n: float = 0.):
|
||||
if a >= b:
|
||||
raise ValueError(
|
||||
"Lower bound of sampling interval must be less than upper bound.")
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.n = n
|
||||
|
|
@ -494,6 +497,9 @@ class PowerLaw(Univariate):
|
|||
@a.setter
|
||||
def a(self, a):
|
||||
cv.check_type('interval lower bound', a, Real)
|
||||
if a < 0:
|
||||
raise ValueError(
|
||||
"PowerLaw sampling is restricted to positive-valued intervals.")
|
||||
self._a = a
|
||||
|
||||
@property
|
||||
|
|
@ -503,6 +509,9 @@ class PowerLaw(Univariate):
|
|||
@b.setter
|
||||
def b(self, b):
|
||||
cv.check_type('interval upper bound', b, Real)
|
||||
if b < 0:
|
||||
raise ValueError(
|
||||
"PowerLaw sampling is restricted to positive-valued intervals.")
|
||||
self._b = b
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue