-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_tuning.py
59 lines (49 loc) · 1.6 KB
/
plot_tuning.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 csv
import matplotlib.pyplot as plt
import sys
import statistics
def first(x):
return next(iter(x))
class impl:
def __init__(self):
self.values = { }
file_performance = sys.argv[1] if len(sys.argv) == 2 else input("Please enter the performance .csv data file: ")
file_quality = sys.argv[1] if len(sys.argv) == 2 else input("Please enter the quality .csv data file: ")
def aggregate(file):
impls = { }
with open(file) as file:
lines = csv.reader(file)
for row in lines:
if len(row) < 3:
continue
name = row[2]
if name not in impls:
impls[name] = impl()
x = row[0] + ',' + row[1]
y = float(row[4])
if (x not in impls[name].values):
impls[name].values[x] = [y]
else:
impls[name].values[x].append(y)
return impls
p = aggregate(file_performance)
q = aggregate(file_quality)
impls = { }
for name in p.keys():
impls[name] = impl()
for k in p[name].values.keys():
impls[name].values[q[name].values[k][0]] = p[name].values[k][0]
for k, v in impls.items():
values = v.values.values()
#avgs = list(map(statistics.mean, values))
#std = list(map(statistics.stdev, values)) if len(first(values)) > 1 else ([0] * len(values))
#xs, ys, std = zip(*sorted(zip(v.values.keys(), avgs, std)))
plt.plot(v.values.keys(), v.values.values(), "o", label=k)
plt.xlabel("Quality")
plt.title("FIFO-Queue Comparison")
plt.xscale("log")
plt.yscale("log")
plt.ylabel("Performance")
plt.grid()
plt.legend()
plt.show()