Skip to content

Commit e6c535f

Browse files
Merge pull request #266 from galenseilis/tidy-separate-input-validation-cases
Separate checking non-negativity from being bounded from above by unity.
2 parents fff36e7 + e3cfdd7 commit e6c535f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ciw/dists/distributions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ class PhaseType(Distribution):
349349
"""
350350

351351
def __init__(self, initial_state, absorbing_matrix):
352-
if any(p < 0 or p > 1.0 for p in initial_state):
353-
raise ValueError("Initial state vector must have valid probabilities.")
352+
if any(p < 0 for p in initial_state):
353+
raise ValueError("Initial state vector must have positive probabilities.")
354+
if any(p > 1.0 for p in initial_state):
355+
raise ValueError("Initial state vector probabilities must be no more than 1.0.")
354356
if sum(initial_state) > 1.0 + 10 ** (-10) or sum(initial_state) < 1.0 - 10 ** (
355357
-10
356358
):

0 commit comments

Comments
 (0)