Skip to content

Commit cb323a0

Browse files
committed
Refactor site sums
1 parent 663b5db commit cb323a0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

python/tests/beagle_numba.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,9 @@ def interpolate_allele_probs(
585585
if max(sum_probs_a_k, sum_probs_a_kM1) > _MIN_THRESHOLD:
586586
probs[i, a] += w * sum_probs_a_kM1
587587
probs[i, a] += (1 - w) * sum_probs_a_k
588-
# Rescale probabilities.
589-
# TODO: Check if this is necessary. Could this be a subtle source of error?
590-
assert np.all(np.sum(probs, axis=1) > 0), "Sum of allele probabilities is not > 0."
591-
probs_rescaled = probs / np.sum(probs, axis=1)[:, np.newaxis]
588+
site_sums = np.sum(probs, axis=1)
589+
assert np.all(site_sums > 0), "Some site sums of allele probabilities is <= 0."
590+
probs_rescaled = probs / site_sums[:, np.newaxis]
592591
if return_weights:
593592
return (probs_rescaled, weights)
594593
return (probs_rescaled, None)

0 commit comments

Comments
 (0)