-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbest-parameters.py
executable file
·42 lines (37 loc) · 1.11 KB
/
best-parameters.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
#!/usr/bin/env python3
#
# Figure: Best parameters for all 9 cells, for all 4 methods, shows in a table.
#
from __future__ import division, print_function
import os
import sys
#import numpy as np
# Load project modules
sys.path.append(os.path.abspath(os.path.join('python')))
import results
# Parameter formatting string
pfmat = '{:<1.5e}'
# Load and format parameters
tables = []
for icell in range(9):
cell = 1 + icell
head = ['Cell ' + str(cell)]
body = [['p' + str(1 + i)] for i in range(9)]
for imethod in range(4):
method = 1 + imethod
head.append('Method ' + str(method))
parameters = results.load_parameters(cell, method)
for p, b in zip(parameters, body):
b.append(pfmat.format(p))
tables.append([head] + body)
# Print parameters
for i, table in enumerate(tables):
print()
ncol = [0] * len(table[0])
for row in table:
for i, col in enumerate(row):
if len(col) > ncol[i]:
ncol[i] = len(col)
for row in table:
row = [col + ' ' * (n - len(col)) for col, n in zip(row, ncol)]
print(' | '.join(row))