-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
121 lines (117 loc) · 4.73 KB
/
README
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
This is a simplified Python pandemic simulator based on infection properties of COVID-19. The inspiration was to
test different quarantine models on the total number of infected (for example, only quarantining the elderly and at-risk to
achieve faster herd immunity and reduce total deaths). However, this simulator is still far too simple to draw meaningful
conclusions.
Contributions are welcome, especially ones that make the model more realistic without being too computationally expensive, or
which provide a means to create a digital graphic of the spread of the disease over time.
Requirements:
pandas
Recommended:
pypy (for speed)
Example:
%run "virus_sim.py"
w = World(20000, 10, 1) # 20,000 people in the "World", randomly distributed on the default 200x200 world-grid, with 10 initially infected who are able to expose people up to 1 tile away in each direction. People move around daily according to their age.
df = w.run_simulation(100) # Run simulation for 100 days.
df
Out[005]:
Population Infected Recovered Dead
0 20000 13 0 0
1 20000 18 0 0
2 20000 23 0 0
3 20000 28 0 0
4 20000 32 0 0
5 20000 42 0 0
6 20000 46 0 0
7 20000 55 0 0
8 20000 63 0 0
9 20000 73 7 0
10 20000 87 10 0
11 20000 95 15 0
12 20000 108 17 0
13 20000 113 24 0
14 20000 135 28 0
15 20000 152 39 0
16 20000 176 43 0
17 20000 197 49 0
18 20000 216 58 0
19 20000 239 73 0
20 20000 278 86 0
21 20000 302 100 0
22 20000 342 117 0
23 20000 379 129 0
24 19999 426 145 1
25 19999 481 172 1
26 19998 549 196 2
27 19997 619 220 3
28 19996 680 252 4
29 19995 765 286 5
30 19995 852 330 5
31 19995 957 382 5
32 19995 1083 422 5
33 19995 1220 470 5
34 19993 1350 528 7
35 19993 1471 607 7
36 19993 1597 683 7
37 19992 1745 771 8
38 19988 1873 864 12
39 19986 2028 968 14
40 19985 2145 1092 15
41 19980 2265 1222 20
42 19977 2367 1381 23
43 19973 2512 1534 27
44 19971 2654 1704 29
45 19966 2733 1910 34
46 19961 2828 2114 39
47 19959 2938 2308 41
48 19955 3040 2517 45
49 19947 3083 2763 53
50 19941 3174 3001 59
51 19935 3223 3268 65
52 19928 3298 3528 72
53 19919 3330 3787 81
54 19911 3368 4064 89
55 19910 3410 4347 90
56 19900 3422 4616 100
57 19896 3399 4927 104
58 19888 3385 5234 112
59 19880 3369 5529 120
60 19874 3341 5834 126
61 19868 3292 6134 132
62 19861 3253 6433 139
63 19857 3140 6769 143
64 19848 3027 7091 152
65 19845 2942 7386 155
66 19842 2849 7696 158
67 19838 2768 7975 162
68 19833 2629 8299 167
69 19826 2558 8556 174
70 19823 2404 8850 177
71 19814 2271 9121 186
72 19809 2159 9382 191
73 19806 2059 9622 194
74 19802 1955 9846 198
75 19797 1849 10064 203
76 19794 1763 10267 206
77 19790 1653 10485 210
78 19787 1562 10675 213
79 19784 1465 10867 216
80 19781 1382 11023 219
81 19779 1278 11204 221
82 19772 1183 11362 228
83 19767 1118 11492 233
84 19765 1044 11617 235
85 19760 972 11731 240
86 19758 892 11873 242
87 19756 803 11994 244
88 19756 730 12106 244
89 19756 687 12191 244
90 19753 602 12299 247
91 19748 557 12367 252
92 19747 493 12451 253
93 19746 457 12509 254
94 19746 405 12580 254
95 19743 368 12633 257
96 19743 333 12690 257
97 19741 308 12728 259
98 19738 280 12765 262
99 19738 257 12797 262