-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plot_Exponential_Network.py
60 lines (44 loc) · 1.27 KB
/
Plot_Exponential_Network.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
import matplotlib.pyplot as plt
import csv
import numpy as np
import EoN
import networkx as nx
import pandas as pd
import random
N = 10**4
kave = 10
tmin = 0
tmax = 200
simulationRuns = 50
tau = 0.025 #transmission rate
gamma = 0.1 #recovery rate
rho = 0.005
step = 0.1 #step size
step_max_plot = 1200
xx = np.arange(0, step_max_plot*step, step)
yy = np.arange(0, step_max_plot*step, step)
plt.figure(figsize=(12,8))
plt.ylim(0.0,800)
nb_initial_infecteds = 50
initial_infecteds = range(nb_initial_infecteds)
df1 = pd.read_csv('Stock/Aparicio_Exponential.csv')
df1 = df1.loc[:, '{#status->#S}']
inc1 = - df1.diff()/0.1
inc1 = inc1[:step_max_plot]
df2 = pd.read_csv('Stock/Stroud_HMS.csv')
df2 = df2.loc[:, '{#status->#S}']
inc2 = - df2.diff()/0.1
inc2 = inc2[:step_max_plot]
df3 = pd.read_csv('Stock/Stroud_Exponential.csv')
df3 = df3.loc[:, '{#status->#S}']
inc3 = - df3.diff()/0.1
inc3 = inc3[:step_max_plot]
plt.plot(xx, inc1, '--', label = 'Aparicio simulation', color = 'green')
plt.plot(xx, inc2, label = 'Homogeneous mixing simulation', color = 'red')
plt.plot(xx, inc3, '-.', label = 'Stroud simulation', color = 'blue')
plt.xlabel('Time')
plt.ylabel('New infections per day')
plt.title('Exponential network')
plt.legend()
plt.show()
plt.savefig('Plot/Expo.png')