-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboxPlotData.py
62 lines (54 loc) · 1.72 KB
/
boxPlotData.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
# This file reads trace files and creates a csv for use with
# an online box plot generator.
import numpy as np
import os
import glob
import csv
from itertools import zip_longest
trials = 25
INST = ['star2','power']
cutOff = 10
ALG = ['LS1','LS2']
nBins = 11*cutOff
for inst in INST:
for alg in ALG:
if inst == 'star2':
exact = 4452
if alg == 'LS1':
qualities = [4.0,4.2,4.4,4.6,4.8,5.0]
else:
qualities = [2.8,3.0,3.2,3.4,3.6,3.8]
else:
exact = 2203
if alg == 'LS1':
qualities = [0.6,0.8,1.0,1.2,1.4,1.6]
else:
qualities = [1.0,1.2,1.4,1.6,1.8,2.0]
bins = np.zeros((nBins,100))
count = np.zeros((nBins,100))
f = open(alg + "_bins.txt",'w')
traces = []
data = []
path = '../output/' + inst + '_' + alg + '*.trace'
for name in glob.glob(path):
traces.append(name)
for i in range(100):
f = open(traces[i])
for line in f:
t = line.split(', ')
for i in range(2):
t[i] = float(t[i].replace("\n",""))
t[1] = ((t[1]-exact)/exact)*100
data.append(t)
bd = [[],[],[],[],[],[]]
for q in range(6):
for d in data:
if abs(d[1] - qualities[q]) < 0.05:
print(d[1])
bd[q].append(d[0])
filename = inst + "_" + alg + "_boxData.csv"
with open(filename,"w+") as f:
writer = csv.writer(f)
writer.writerow(qualities)
for values in zip_longest(*bd):
writer.writerow(values)