-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test convolve mode in hospitaladmissionspy (#398)
* testing convolve mode * update tutorial to work with convolve mode valid * update latent admissions test * update DOW tutorial for convolve mode valid * update hosp model tests * create helper function for convolve and add tests * forgot to run precommit earlier * update test for model with DOW effect * renaming helper function, add n_initialization_point * Apply suggestions from code review Co-authored-by: Dylan H. Morris <[email protected]> * move helper function from metaclass to convolve.py * uniformize starting point of all plots * adopt new var names * fix var names * fix docstring * update n_initialization_points * Update pyrenew/convolve.py * Update pyrenew/convolve.py --------- Co-authored-by: Dylan H. Morris <[email protected]> Co-authored-by: Damon Bayer <[email protected]>
- Loading branch information
1 parent
769712b
commit 1a86104
Showing
7 changed files
with
221 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# numpydoc ignore=GL08 | ||
|
||
import jax.numpy as jnp | ||
import pytest | ||
from numpy.testing import assert_array_equal | ||
|
||
from pyrenew.convolve import compute_delay_ascertained_incidence | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["obs_rate", "latent_incidence", "delay_interval", "expected_output"], | ||
[ | ||
[ | ||
jnp.array([1.0]), | ||
jnp.array([1.0, 2.0, 3.0]), | ||
jnp.array([1.0]), | ||
jnp.array([1.0, 2.0, 3.0]), | ||
], | ||
[ | ||
jnp.array([1.0, 0.1, 1.0]), | ||
jnp.array([1.0, 2.0, 3.0]), | ||
jnp.array([1.0]), | ||
jnp.array([1.0, 0.2, 3.0]), | ||
], | ||
[ | ||
jnp.array([1.0]), | ||
jnp.array([1.0, 2.0, 3.0]), | ||
jnp.array([0.5, 0.5]), | ||
jnp.array([1.5, 2.5]), | ||
], | ||
[ | ||
jnp.array([1.0]), | ||
jnp.array([0, 2.0, 4.0]), | ||
jnp.array([0.25, 0.5, 0.25]), | ||
jnp.array([2]), | ||
], | ||
], | ||
) | ||
def test(obs_rate, latent_incidence, delay_interval, expected_output): | ||
""" | ||
Tests for helper function to compute | ||
incidence observed with a delay | ||
""" | ||
result = compute_delay_ascertained_incidence( | ||
obs_rate, | ||
latent_incidence, | ||
delay_interval, | ||
) | ||
assert_array_equal(result, expected_output) |
Oops, something went wrong.