-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawer.py
74 lines (59 loc) · 2.09 KB
/
drawer.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
import matplotlib.pyplot as plt
import numpy as np
num_of_logs = 3093
name = 'SSbot'
kills, deaths, diffs = {}, {}, {}
for i in range(1, num_of_logs+1):
with open('logs/'+str(i)+'.log', 'r') as f:
lines = f.read().split('\n')
for j in lines:
words = j.split('\t')
if words[1] in kills:
kills[words[1]].append(float(words[2]))
deaths[words[1]].append(float(words[3]))
diffs[words[1]].append(float(words[4]))
else:
kills[words[1]] = [float(words[2])]
deaths[words[1]] = [float(words[3])]
diffs[words[1]] = [float(words[4])]
window = 200
meaned_kills, meaned_deaths, meaned_diffs = {i:[] for i in kills.keys()}, \
{i:[] for i in kills.keys()}, \
{i:[] for i in kills.keys()}
for name in kills:
#if not name.startswith('Target'):
for i in range(window, num_of_logs):
meaned_kills[name].append(sum(kills[name][i+1-window:i+1])/window)
meaned_deaths[name].append(sum(deaths[name][i + 1 - window:i + 1])/window)
meaned_diffs[name].append(sum(diffs[name][i + 1 - window:i + 1])/window)
for name in kills:
plt.plot(range(num_of_logs), kills[name])
plt.legend(kills.keys())
plt.title('Kills')
plt.show()
for name in deaths:
plt.plot(range(num_of_logs), deaths[name])
plt.legend(deaths.keys())
plt.title('Deaths')
plt.show()
for name in diffs:
plt.plot(range(num_of_logs), diffs[name])
plt.legend(diffs.keys())
plt.title('Diffs')
plt.show()
for name in meaned_kills:
print len(meaned_kills[name]), num_of_logs-window
plt.plot(range(window, num_of_logs), meaned_kills[name])
plt.legend(meaned_kills.keys())
plt.title('Mean kills')
plt.show()
for name in meaned_deaths:
plt.plot(range(window, num_of_logs), meaned_deaths[name])
plt.legend(deaths.keys())
plt.title('Mean deaths')
plt.show()
for name in meaned_diffs:
plt.plot(range(window, num_of_logs), meaned_diffs[name])
plt.legend(meaned_diffs.keys())
plt.title('Mean diffs')
plt.show()