Skip to content

Commit 5e74b9f

Browse files
authored
Merge pull request #1011 from adilraza99/GH1010-skip-ci-when-nobs-zero
fix: return NaN confidence intervals when cohort size is zero
2 parents 78d22ff + 212ebaa commit 5e74b9f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

malariagen_data/anoph/frq_base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def _add_frequency_ci(*, ds, ci_method):
140140
frq_ci_low, frq_ci_upp = proportion_confint(
141141
count=count, nobs=nobs, method=ci_method
142142
)
143+
loc_zero = nobs == 0
144+
frq_ci_low[loc_zero] = np.nan
145+
frq_ci_upp[loc_zero] = np.nan
143146
ds["event_frequency_ci_low"] = ("variants", "cohorts"), frq_ci_low
144147
ds["event_frequency_ci_upp"] = ("variants", "cohorts"), frq_ci_upp
145148

0 commit comments

Comments
 (0)