1 import matplotlib.pyplot
as plt
2 import csv, sys, numpy
as np
7 with open(filename,
"r") as file: 8 reader = csv.reader(file, strict=True)
11 converters = (str, int, int, int, float,
lambda x: float(x) * 1e-3)
14 if fieldnames
is None:
15 fieldnames = [n.strip()
for n
in row]
19 values.append([c(v)
for v, c
in zip(row, converters)])
21 request1 = values[: int(len(values) / 2)]
22 request2 = values[int(len(values) / 2) :]
25 while values[0][0:3] == values[Ntransforms][0:3]:
28 splitMethods = [
"avg",
"med",
"cen"]
34 BVs = sorted(list(set([v[0] for v
in request1[::Ntransforms]])))
36 BVs.index(v[0]) + len(BVs) * v[2] + 3 * len(BVs) * v[1]
37 for v
in request1[::Ntransforms]
40 v[0] +
" " + type[v[1]] +
" " + splitMethods[v[2]]
for v
in request1[::Ntransforms]
43 idx_reorder = sorted(list(range(len(xvals))), key=
lambda i: xvals[i])
47 return [l[i]
for i
in idx_reorder]
56 for i
in range(Ntransforms):
60 reorder([v[5]
for v
in request1[i::Ntransforms]]),
66 reorder([v[5]
for v
in request2[i::Ntransforms]]),
72 plt.xticks(ticks=xvals_s, labels=cases_s, rotation=90)
73 plt.ylabel(
"Time (us)")
78 for k
in range(0, len(request1), Ntransforms):
82 xvals[int(k / Ntransforms)],
84 sum([v[5]
for v
in request1[k : k + Ntransforms]]) / Ntransforms,
88 xvals[int(k / Ntransforms)],
90 sum([v[5]
for v
in request2[k : k + Ntransforms]]) / Ntransforms,
97 sum([v[5]
for v
in request2[k : k + Ntransforms]]) / Ntransforms
98 for k
in range(0, len(request1), Ntransforms)
103 plt.xticks(ticks=xvals_s, labels=cases_s, rotation=90)
104 plt.ylabel(
"Time (us)")
109 for i
in range(Ntransforms):
110 if request2[i][3] > 0:
114 reorder([v[4]
for v
in request2[i::Ntransforms]]),
116 label=
str(i) +
"+lb",
120 plt.ylabel(
"Distance lower bound")
121 plt.xticks(ticks=xvals_s, labels=cases_s, rotation=90)