-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobals.py
51 lines (38 loc) · 1.67 KB
/
globals.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
# this might be bad practise, but I am using some global variables in order to keep function signatures minimal
# they are saved here for now
import numpy as np
# p_i = 0.5 # probability of infection at contact # TODO didnt want this global anymore, change everywhere
t_i = 2 # incubation time
t_r = 10 # recovery time
t_c = 1 # time between contacts
t_d = 6 # average time until infection is noticed
t_t = 4 # average time until contact is found and put into quarantine
p_q = 0.5 # fraction of cases where the infection is noticed and quarantine is issued
p_t = 0.75
quarantine_time = 14 # this should probably be a fixed time
# NOTE: this is the same as the scale parameter in np.random.exponential! No inverse needed! Checked experimentally...
resolution = 1 # days for each animation frame, abtastrate (right now only ints are possible)
# TODO maybe allow floats as well and use linspace instead of arange?
redo_net = 5 # every i iterations, monte carlo also changes network
# epsilon = 0
epsilon_disp = 0.001
epsilon_clustering = 0.1 # this is a relative epsilon (to p of network). 0.1 means within 10% of p
INFECTION = 0
INFECTIOUS = 1
CONTACT = 2
RECOVER = 3
QUARANTINE = 4
END_OF_QUARANTINE = 5
TRACING = 6
SUSC_STATE = 0
EXP_STATE = 1
INF_STATE = 2
REC_STATE = 3
NO_TRANS_STATE = 4
# update the counts in the events by adding these to self.count:
susc2exp = np.asarray([-1, 1, 0, 0], dtype=np.int32)
exp2inf = np.asarray([0, -1, 1, 0], dtype=np.int32)
inf2rec = np.asarray([0, 0, -1, 1], dtype=np.int32)
inf2no_trans = np.asarray([0, 0, -1, 0], dtype=np.int32)
# no_trans2rec = np.asarray([0, 0, 0, 1, -1], dtype=np.int32)
# no_trans2inf = np.asarray([0, 0, 1, 0, -1], dtype=np.int32)