-
Notifications
You must be signed in to change notification settings - Fork 11
/
starter.py
103 lines (91 loc) · 2.6 KB
/
starter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Santiago Nunez-Corrales and Eric Jakobsson
# Illinois Informatics and Molecular and Cell Biology
# University of Illinois at Urbana-Champaign
# {nunezco,jake}@illinois.edu
# A simple tunable model for COVID-19 response
from covidmodel import CovidModel
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
from covidmodel import CovidModel
from covidmodel import Stage
from covidmodel import AgeGroup
from covidmodel import SexGroup
from covidmodel import LockGroup
# Specific model data
# Observed distribution of mortality rate per age
cr_age_mortality = {
AgeGroup.C80toXX: 0.148,
AgeGroup.C70to79: 0.08,
AgeGroup.C60to69: 0.036,
AgeGroup.C50to59: 0.013,
AgeGroup.C40to49: 0.004,
AgeGroup.C30to39: 0.002,
AgeGroup.C20to29: 0.002,
AgeGroup.C10to19: 0.002,
AgeGroup.C00to09: 0.0
}
# Observed distribution of mortality rage per sex
cr_sex_mortality = {
SexGroup.MALE: 0.62,
SexGroup.FEMALE: 0.38
}
cr_age_distribution = {
AgeGroup.C80toXX: 0.023,
AgeGroup.C70to79: 0.03,
AgeGroup.C60to69: 0.078,
AgeGroup.C50to59: 0.109,
AgeGroup.C40to49: 0.128,
AgeGroup.C30to39: 0.169,
AgeGroup.C20to29: 0.169,
AgeGroup.C10to19: 0.148,
AgeGroup.C00to09: 0.146
}
# Observed distribution of mortality rage per sex
cr_sex_distribution = {
SexGroup.MALE: 0.496,
SexGroup.FEMALE: 0.504
}
model_params = {
"N":255,
"width":50,
"height":50,
"distancing": False,
"amort": cr_age_mortality,
"smort": cr_sex_mortality,
"adist": cr_age_distribution,
"sdist": cr_sex_distribution,
"avinc": 5,
"avrec": 15,
"pasympt": 0.2,
"pcont": 0.04,
"pdet": 0.0,
"plock": 0.5,
"peffl": 0.8,
"psev": 0.03,
"ddet": 10,
"dimp": 8
}
cm = CovidModel(model_params["N"],
model_params["width"],
model_params["height"],
model_params["distancing"],
model_params["pasympt"],
model_params["amort"],
model_params["smort"],
model_params["avinc"],
model_params["avrec"],
model_params["psev"],
model_params["adist"],
model_params["sdist"],
model_params["plock"],
model_params["peffl"],
model_params["pcont"],
model_params["pdet"],
model_params["ddet"],
model_params["dimp"])
# Simulate for 90 days
for i in range(90 * cm.dwell_15_day):
cm.step()
trends = cm.datacollector.get_model_vars_dataframe()
trends.to_csv('cr_0.5_distancing_0.80_eff.csv')