-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluate_doe.py
More file actions
executable file
·99 lines (79 loc) · 2.31 KB
/
evaluate_doe.py
File metadata and controls
executable file
·99 lines (79 loc) · 2.31 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import sys,json
import subprocess
import sys
sys.path.append("models")
from model_simple import f_xy
sys.path.append("utils")
from radar import createRadar
from sensitivity import createSensitivity
f = open('inputs_doe.csv')
inputs = f.readlines()
f.close()
input_labels=['x','y']
output_labels=['z']
allInputs=[]
allOutputs=[]
headers=[]
for i,input in enumerate(inputs):
if i==0:
headers=[xx.strip() for xx in input.split(',')]
continue
print(i,'/',len(inputs)-1)
idata = [xx.strip() for xx in input.split(',')]
for ii,id in enumerate(idata):
exec("{}={}".format(headers[ii],float(id)))
# evalute the model
z = f_xy(x,y)
inp=[x,y]
outp=[z]
print('inputs',inp)
print('outputs',outp)
allInputs.append(inp)
allOutputs.append(outp)
# postprocessing of the results
allData = []
row=[]
for i in input_labels:
row.append('in:'+i)
for o in output_labels:
row.append('out:'+o)
row.append('img:plot')
allData.append(",".join(row))
# get all the data organized for min/max values
allDataHash={}
for ir,r in enumerate(allInputs):
for ii,i in enumerate(allInputs[ir]):
try:
allDataHash[input_labels[ii]].append(i)
except:
allDataHash[input_labels[ii]] = []
allDataHash[input_labels[ii]].append(i)
for io,o in enumerate(allOutputs[ir]):
try:
allDataHash[output_labels[io]].append(o)
except:
allDataHash[output_labels[io]] = []
allDataHash[output_labels[io]].append(o)
# create the rows
print("")
for ir,r in enumerate(allInputs):
print("plotting",ir+1,'/',len(allInputs)-1)
row=[]
headers=[]
for ii,i in enumerate(allInputs[ir]):
row.append((i))
headers.append(input_labels[ii])
for io,o in enumerate(allOutputs[ir]):
row.append((o))
headers.append(output_labels[io])
# make the radar plots
plot = createRadar(str(ir),row,headers,allDataHash)
#plot = 'plots/case_'+str(ir)+'.png'
row.append(plot)
allData.append(",".join([str(x) for x in row]))
# generate the output csv data
f = open('outputs_doe.csv','w')
f.write("\n".join(allData))
f.close()
# generate the sensitivity plot
createSensitivity('outputs_doe.csv',input_labels,output_labels)