We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d10ae4 commit 0fc8eb6Copy full SHA for 0fc8eb6
sgkit/stats/popgen.py
@@ -92,12 +92,12 @@ def diversity(
92
93
ac = ds[cohort_allele_count]
94
an = ac.sum(axis=2)
95
- n_pairs = an * (an - 1) / 2
96
- n_same = (ac * (ac - 1) / 2).sum(axis=2)
+ n_pairs = an * (an - 1) // 2
+ n_same = (ac * (ac - 1) // 2).sum(axis=2)
97
n_diff = n_pairs - n_same
98
# replace zeros to avoid divide by zero error
99
n_pairs_na = n_pairs.where(n_pairs != 0)
100
- pi = n_diff / n_pairs_na
+ pi = n_diff.astype(np.float64) / n_pairs_na.astype(np.float64)
101
102
if has_windows(ds):
103
div = window_statistic(
0 commit comments