sgkit-dev / sgkit

Scalable genetics toolkit
https://sgkit-dev.github.io/sgkit
Apache License 2.0
217 stars 32 forks source link

Main build failing with 'RuntimeWarning: overflow encountered in scalar subtract' #1225

Closed tomwhite closed 2 weeks ago

tomwhite commented 3 weeks ago

Looks like it may be due to stricter checks in NumPy 2.0.0.

tau_p = np.uint8(0), lambda_p = np.float64(0.0), ploidy_p = np.uint64(2)
kinship_pp = 0.0, tau_q = np.uint8(2), lambda_q = np.float64(0.167)
ploidy_q = np.uint64(4), kinship_qq = np.float64(0.307798800184587)
kinship_pq = 0.0

    @numba_jit
    def _hamilton_kerr_inbreeding_non_founder(
        tau_p: int,
        lambda_p: float,
        ploidy_p: int,
        kinship_pp: float,
        tau_q: int,
        lambda_q: float,
        ploidy_q: int,
        kinship_qq: float,
        kinship_pq: float,
    ) -> float:  # pragma: no cover
        """Calculate the inbreeding coefficient of a non founder
        individual i with parents p and q.
        """
        pat = (
            tau_p
>           * (tau_p - 1)
            * (lambda_p + (1 - lambda_p) * ((ploidy_p * kinship_pp - 1) / (ploidy_p - 1)))
        )
E       RuntimeWarning: overflow encountered in scalar subtract

From https://github.com/sgkit-dev/sgkit/actions/runs/9540232291/job/26291678469