From 4036f6a67ff9d1c081e87f3d75956160cd473dad Mon Sep 17 00:00:00 2001 From: szhan Date: Wed, 19 Jun 2024 13:47:14 +0100 Subject: [PATCH] Check that first value in recomb. prob. array is zero --- lshmm/api.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lshmm/api.py b/lshmm/api.py index 7b32f38..2a16765 100644 --- a/lshmm/api.py +++ b/lshmm/api.py @@ -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." )