Commit fe5c1fbb authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Update test_fcl_collision + Add a Python script to display benchmark data.

parent c76bc1e9
import matplotlib.pyplot as plt
import csv, sys, numpy as np
from math import sqrt
filename = sys.argv[1]
with open(filename, 'r') as file:
reader = csv.reader (file, strict = True)
fieldnames = None
#fieldnames = reader.fieldnames
converters = (str, int, int, int, float, lambda x: float(x)*1e-3)
for row in reader:
if fieldnames is None:
fieldnames = [ n.strip() for n in row]
values = []
continue
values.append ( [ c(v) for v, c in zip(row, converters) ] )
request1 = values[:int(len(values)/2)]
request2 = values[int(len(values)/2):]
Ntransforms = 1
while values[0][0:3] == values[Ntransforms][0:3]:
Ntransforms += 1
splitMethods = ['avg', 'med', 'cen']
BVs = list (set ([ v[0] for v in request1[::Ntransforms] ]))
xvals = [ BVs.index(v[0]) + len(BVs)*v[2] + 3*len(BVs)*v[1] for v in request1[::Ntransforms] ]
cases = [ v[0] + ("*" if v[1] == 1 else "") + " " + splitMethods[v[2]] for v in request1[::Ntransforms] ]
idx_reorder = sorted (list(range(len(xvals))), key=lambda i: xvals[i])
def reorder (l): return [ l[i] for i in idx_reorder ]
xvals_s = reorder (xvals)
cases_s = reorder (cases)
# Time
plt.figure(0)
for i in range(Ntransforms):
plt.plot(xvals_s, reorder([ v[5] for v in request1[i::Ntransforms] ]) , '-.o', label=str(i))
plt.plot(xvals_s, reorder([ v[5] for v in request2[i::Ntransforms] ]) , ':+', label=str(i)+"+lb")
plt.legend()
plt.xticks(ticks=xvals_s, labels=cases_s, rotation=90)
plt.ylabel('Time (us)')
plt.yscale('log')
# Distance
plt.figure(1)
for i in range(Ntransforms):
plt.plot(xvals_s, reorder([ v[4] for v in request2[i::Ntransforms] ]) , ':+', label=str(i)+"+lb")
plt.legend()
plt.ylabel('Distance lower bound')
plt.xticks(ticks=xvals_s, labels=cases_s, rotation=90)
plt.show()
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment