Skip to content

Commit

Permalink
Check the first value in recombination probability array
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jun 19, 2024
1 parent a784916 commit d30a967
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lshmm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ def check_inputs(
raise ValueError(err_msg)

# Check the recombination probability.
if not (
isinstance(prob_recombination, (int, float))
or (
isinstance(prob_recombination, np.ndarray)
and len(prob_recombination) == num_sites
)
if isinstance(prob_recombination, (int, float)):
pass
elif (
isinstance(prob_recombination, np.ndarray)
and len(prob_recombination) == num_sites
):
if prob_recombination[0] != 0:
err_msg = "First value in the recombination probability array must be zero."
raise ValueError(err_msg)
else:
err_msg = (
"Recombination probability is not a scalar or an array of expected length."
)
Expand Down

0 comments on commit d30a967

Please sign in to comment.