astheeggeggs / lshmm

code to run Li and Stephens
MIT License
3 stars 3 forks source link

First item in input recombination probability must be zero #118

Closed szhan closed 2 weeks ago

szhan commented 2 weeks ago

A check should be implemented in api.py to check that the first value of the input recombination probability array is zero.

szhan commented 2 weeks ago

Something like below should be added to check_inputs.

    # Check the recombination probability.
    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."
        )
        raise ValueError(err_msg)