Skip to content

Commit efa3dbd

Browse files
committed
Remove a lot of dead assignments to ease changes to model code
1 parent 865cfba commit efa3dbd

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/penn_chime/models.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,15 @@ def __init__(self, p: Parameters):
5252
susceptible = p.population - infected
5353

5454
intrinsic_growth_rate = get_growth_rate(p.doubling_time)
55+
self.intrinsic_growth_rate = intrinsic_growth_rate
5556

5657
gamma = 1.0 / p.infectious_days
57-
58-
# Contact rate, beta
59-
beta = (
60-
(intrinsic_growth_rate + gamma)
61-
/ susceptible
62-
* (1.0 - p.relative_contact_rate)
63-
) # {rate based on doubling time} / {initial susceptible}
64-
65-
# r_t is r_0 after distancing
66-
r_t = beta / gamma * susceptible
67-
68-
# Simplify equation to avoid division by zero:
69-
# self.r_naught = r_t / (1.0 - relative_contact_rate)
70-
r_naught = (intrinsic_growth_rate + gamma) / gamma
58+
self.gamma = gamma
7159

7260
self.susceptible = susceptible
7361
self.infected = infected
7462
self.recovered = p.recovered
7563

76-
self.beta = beta
77-
self.gamma = gamma
78-
self.beta_t = get_beta(intrinsic_growth_rate, self.gamma, self.susceptible, p.relative_contact_rate)
79-
self.intrinsic_growth_rate = intrinsic_growth_rate
80-
8164
if p.date_first_hospitalized is None and p.doubling_time is not None:
8265
logger.info('Using doubling_time: %s', p.doubling_time)
8366
self.i_day = 0
@@ -94,8 +77,6 @@ def __init__(self, p: Parameters):
9477
self.beta_t = get_beta(intrinsic_growth_rate, self.gamma, self.susceptible, p.relative_contact_rate)
9578
self.run_projection(p)
9679

97-
self.r_t = self.beta_t / gamma * susceptible
98-
self.r_naught = self.beta / gamma * susceptible
9980
logger.info('Set i_day = %s', i_day)
10081
p.date_first_hospitalized = p.current_date - timedelta(days=i_day)
10182
logger.info(
@@ -148,6 +129,7 @@ def __init__(self, p: Parameters):
148129
self.susceptible = self.raw_df['susceptible'].values[self.i_day]
149130
self.recovered = self.raw_df['recovered'].values[self.i_day]
150131

132+
# r_t is r_0 after distancing
151133
self.r_t = self.beta_t / gamma * susceptible
152134
self.r_naught = self.beta / gamma * susceptible
153135

0 commit comments

Comments
 (0)