Heating controller with neural thermal model written in Python
Jacek Kowalski
2018-06-24 425bf71fc0b24b547006686d83404c54b983de0b
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('extend_*'):
13     with open(filename) as fp:
14         reader = csv.reader(fp, delimiter=' ')
15         for row in reader:
16             assert row[0] == 'RESULT'
17             
18             if row[1] not in results:
19                 results[row[1]] = [ [], [], [] ]
20             
21             for i in range(3):
22                 results[row[1]][i].append(float(row[2+i]))
23
24 def key_fix(x):
25     return int(x[0])
26
27 results = collections.OrderedDict(sorted(results.items(), key=key_fix))
28
29 for i in results:
30     print(i, end='')
31     for j in range(len(results[i])):
32         print('', statistics.mean(results[i][j]), statistics.stdev(results[i][j]), end='')
33     print()