Skip to content
Merged
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
9 changes: 9 additions & 0 deletions openmc/stats/univariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -494,6 +497,9 @@ def a(self):
@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
Expand All @@ -503,6 +509,9 @@ def b(self):
@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
Expand Down