Heating controller with neural thermal model written in Python
Jacek Kowalski
2018-06-24 66a9fb40efe1311b34a3cee3f83f10c6990759af
commit | author | age
425bf7 1 #!/usr/bin/env python3
JK 2
3 import collections
4 import csv
5 import glob
6 import statistics
7
8 # type-values-aggregation-model[-epochs]
9
10 results = {}
11
12 for filename in glob.glob('design_*'):
13     with open(filename) as fp:
14         reader = csv.reader(fp, delimiter=' ')
15         for row in reader:
16             assert row[0] == 'RESULT'
17             
18             index = (row[1], int(row[2]))
19             
20             if index not in results:
21                 results[index] = [ [], [], [] ]
22             
23             for i in range(3):
24                 results[index][i].append(float(row[3+i]))
25
26
27 results = collections.OrderedDict(sorted(results.items()))
28
29 last = None
30 for i in results:
31     if last and last != i[0]:
32         print()
33         print()
34     last = i[0]
35     
36     print(i[0], i[1], end='')
37     for j in range(len(results[i])):
38         print('', statistics.mean(results[i][j]), statistics.stdev(results[i][j]), end='')
39     print()