Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming sample_infections to compute_future_infections #137

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions model/src/pyrenew/latent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
)
from pyrenew.latent.i0 import Infections0
from pyrenew.latent.infection_functions import (
compute_infections_from_rt,
compute_infections_from_rt_with_feedback,
logistic_susceptibility_adjustment,
sample_infections_rt,
sample_infections_with_feedback,
)
from pyrenew.latent.infections import Infections

Expand All @@ -19,7 +19,7 @@
"InfectHospRate",
"Infections",
"logistic_susceptibility_adjustment",
"sample_infections_rt",
"sample_infections_with_feedback",
"compute_infections_from_rt",
"compute_infections_from_rt_with_feedback",
"Infections0",
]
12 changes: 7 additions & 5 deletions model/src/pyrenew/latent/infection_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
from pyrenew.convolve import new_convolve_scanner, new_double_scanner


def sample_infections_rt(
I0: ArrayLike, Rt: ArrayLike, reversed_generation_interval_pmf: ArrayLike
def compute_infections_from_rt(
I0: ArrayLike,
Rt: ArrayLike,
reversed_generation_interval_pmf: ArrayLike,
) -> ArrayLike:
"""
Sample infections according to a
Generate infections according to a
renewal process with a time-varying
reproduction number R(t)

Expand Down Expand Up @@ -84,15 +86,15 @@ def logistic_susceptibility_adjustment(
return n_population * frac_susceptible * approx_frac_infected


def sample_infections_with_feedback(
def compute_infections_from_rt_with_feedback(
I0: ArrayLike,
Rt_raw: ArrayLike,
infection_feedback_strength: ArrayLike,
generation_interval_pmf: ArrayLike,
infection_feedback_pmf: ArrayLike,
) -> tuple:
"""
Sample infections according to
Generate infections according to
a renewal process with infection
feedback (generalizing Asher 2018:
https://doi.org/10.1016/j.epidem.2017.02.009)
Expand Down
2 changes: 1 addition & 1 deletion model/src/pyrenew/latent/infections.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def sample(
n_lead = gen_int_rev.size - 1
I0_vec = jnp.hstack([jnp.zeros(n_lead), I0])

all_infections = inf.sample_infections_rt(
all_infections = inf.compute_future_infections_rt(
gvegayon marked this conversation as resolved.
Show resolved Hide resolved
I0=I0_vec,
Rt=Rt,
reversed_generation_interval_pmf=gen_int_rev,
Expand Down
Loading