-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathpostprocess_results.py
More file actions
51 lines (45 loc) · 1.25 KB
/
postprocess_results.py
File metadata and controls
51 lines (45 loc) · 1.25 KB
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
import os
import numpy as np
from sys import argv
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
def get_best_value(name):
means = []
stds = []
names = []
for file_ in os.listdir(name):
results = []
try:
with open(name+'/'+file_,'r') as file:
for line in file:
line = line.split(' ')
if (isfloat(line[0])):
results.append(float(line[0]))
results = np.array(results)
if results.size > 4:
means.append(np.mean(results))
stds.append(np.std(results))
else:
means.append(-1000)
stds.append(-1000)
names.append(file_)
except:
means.append(-1000.)
names.append(file_)
print('Couldn\'t open file with name: ', file_)
means = np.array(means)
stds = np.array(stds)
means_sorted = np.sort(means)
args = np.argsort(means)
if (len(argv) > 1):
best_range = 162
else:
best_range = 162
for i in range(1,1+best_range):
print(means_sorted[-i], stds[args[-i]],names[args[-i]])
name = argv[1]
get_best_value(name)