-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintresults.py
executable file
·56 lines (49 loc) · 1.63 KB
/
printresults.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
"""Print data from a resultset to the standard output.
Usage:
python printresults.py <results-file.pickle>
"""
import argparse
from icarus.registry import RESULTS_READER
__all__ = ['print_results']
read = RESULTS_READER['PICKLE']
def print_results(path):
"""Print a resultset saved as pickle.
Parameters
----------
input : str
The path to the pickled resultset
"""
rs = read(path)
n = len(rs)
i = 0
for experiment, results in rs:
i += 1
print("EXPERIMENT %d/%d:" % (i, n))
print(" CONFIGURATION:")
for k, v in experiment.items():
if isinstance(v, dict):
s = " * %s ->" % str(k)
if 'name' in v:
s += " name: %s," % str(v.pop('name'))
for group, value in v.items():
s += " %s: %s," % (str(group), str(value))
print(s.rstrip(","))
else:
print(" * %s -> %s" % (str(k), str(v)))
print(" RESULTS:")
for collector, data in results.items():
if isinstance(data, dict):
print(" %s" % str(collector))
for metric, value in data.items():
print(" * %s: %s" % (str(metric), str(value)))
else:
print(" * %s: %s" % (str(collector), str(data)))
print("")
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("input", help="The simulation results file")
args = parser.parse_args()
print_results(args.input)
if __name__ == "__main__":
main()