Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paigemiller committed Dec 3, 2024
1 parent 5ad4750 commit 908c8c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions scratch/viz.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ value
vector
```

This breaks down the math going into our estimates. For this 2 group population with 1000 individuals, where 200 are high risk and 800 lower risk individuals, we vaccinate 100 of the high risk individuals. To calculate Re, we multiply the beta matrix by the population distribution of each group (s_i in this example) and the proportion of each group that remains susceptible post vaccination distribution (s_vax in this example).

# 4 group model

```{python}
# parameters (core, kids, travelers, general)
# parameters (core, kids, general)
n = np.array([0.1, 0.45, 0.05, 0.4]) * 1000000
p_severe = np.array([0.01, 0.1, 0.01, 0.01])
p_severe = np.array([0.01, 0.1, 0.01])
ve = 0.74
# within between group R
Expand Down Expand Up @@ -166,5 +168,3 @@ plt.grid(True)
plt.show()
```

the number of deaths under different vaccine strategies doesn't vary that much (53 - 54)
16 changes: 8 additions & 8 deletions tests/test_ngm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def test_vax_beta():
current = ngm.get_R(beta=beta, n=n, n_vax=n_vax, ve=ve)
expected = np.array(
[
[10.0 * 1 / 9, 0.1 * 8/9],
[0.1 * 1/9, 1 * 8/9],
[10.0 * .2 * .5, 0.1 * .8 * .5],
[0.1 * .2 * .5, 1 * .8 * .5],
]
)

Expand All @@ -50,17 +50,17 @@ def test_simulate():
assert np.isclose(current["Re"], 0.92)
assert_array_equal(
current["R"],
np.array([[0.6, 0.1, 0.6, 0.1],
[0.1, 0.1, 0.1, 0.1],
[0.3, .05, 0.05, 0.05],
[0.25, 0.25, 0.25, 0.25]]),
np.array([[0.6, 0.1, 0.3, 0.25],
[0.1, 0.1, 0.05, 0.25],
[0.6, 0.1, 0.05, 0.25],
[0.1, 0.1, 0.05, 0.25]]),
)
assert_array_equal(
np.round(current["infections"], 6), np.array([0.44507246, 0.10853944, 0.17503951, 0.2713486])
np.round(current["infections"], 6), np.array([0.43969484, 0.107228 , 0.34584916, 0.107228])
)
assert_array_equal(
np.round(current["severe_infections"], 6),
np.array([0.00820112, 0.006, 0.00322536, 0.005]),
np.array([[0.00810203, 0.0059275 , 0.00637278, 0.00197583]]),
)


Expand Down

0 comments on commit 908c8c3

Please sign in to comment.