-
Notifications
You must be signed in to change notification settings - Fork 0
/
Analize.py
65 lines (46 loc) · 1.53 KB
/
Analize.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
__author__ = 'Roshan'
import math
import matplotlib.pyplot as plt
class Analize_:
def __init__(self, key, val):
self.key = (int(key[0]), int(key[1]))
self.val = val
def __str__(self):
return "{:4} {:4} {:12}".format(self.key[0], self.key[1], round(self.val,3))
if '__main__' == __name__:
f = open("result.txt")
collect = {}
data = []
for line in f:
d = line.split(",")
d = [ i.strip() for i in d ]
d_ = [ i.split(":")[1] for i in d ]
d_ = [ i.strip() for i in d_ ]
n = [ float(i) for i in d_ ]
collect.setdefault((n[0], n[1]), []).append((n[2], n[3]))
for d in collect:
# print(d)
s = collect[d]
# k = "\n".join(str(i[1]) for i in s)
k = sum(map(lambda x: x[1], s))/len(s)
data.append(Analize_(d, k))
data.sort(key=lambda x: x.key[0]*1000+x.key[1])
g = []
index = 0
while index < len(data):
d = data[index: index+8]
index += 8
t = []
for i in d:
t.append(i)
print(i)
print()
plt.plot([i.val for i in t], label="window size: " + str(t[0].key[0]))
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
ncol=2, mode="expand", borderaxespad=0.)
g.append(t)
plt.ylabel("Speed: bytes/sec")
plt.xlabel("Error rate out of 10")
plt.grid(b=True, which='major', color='b', linestyle='-')
# plt.grid(b=True, which='minor', color='r', linestyle='--')
plt.show()