You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a test of Counts sampling with obs=None where observations are dense and the delay PMF is of length > 1 #660
Not for this PR: a test of Counts sampling with obs=None where observations are dense and the delay PMF is of length > 1 would have revealed the issue with NaN padding and -1s. Should add.
Tests added to test/test_observation_counts.py exercise this scenario: obs=None, dense, delay PMF longer than 1:
TestCountsBasics.test_delay_convolution (line 42) — 2-element delay PMF, obs=None, asserts predicted[:1] is NaN (init period), predicted[1:] is non-NaN, and observed >= 0 everywhere (line 60). If the NaN init positions were
leaking -1s or NaNs into the sampled observed, this assertion would fail.
TestCountsCornerCases.test_long_delay_distribution (line 232) — 10-element delay PMF (the long_delay_pmf fixture), obs=None, asserts both ~jnp.isnan(result.observed) and result.observed >= 0 (lines 244–245).
Combined with the current sample() logic in pyrenew/observation/count_observations.py:375 — safe_predicted = jnp.where(isnan, 1.0, predicted_counts) fed to noise.sample, so NaN-predicted positions sample from Poisson(1.0 + ε)
rather than propagating NaN or -1 — the NaN-padding/-1s issue is both fixed and guarded by tests.
Not for this PR: a test of
Countssampling withobs=Nonewhere observations are dense and the delay PMF is of length > 1 would have revealed the issue with NaN padding and -1s. Should add.Originally posted by @dylanhmorris in #644 (comment)