|
16 | 16 | with open(args.right, "rb") as f: |
17 | 17 | right = pickle.load(f) |
18 | 18 |
|
19 | | -if left.keys()!=right.keys(): |
| 19 | +if left.keys() != right.keys(): |
20 | 20 | raise ValueError("Different Experiments") |
21 | 21 |
|
22 | 22 | experiment = right.keys() |
23 | 23 |
|
24 | 24 | for exp in experiment: |
25 | 25 | print("\nExperiment: {}".format(exp)) |
26 | | - if left[exp].keys()!=right[exp].keys(): |
| 26 | + if left[exp].keys() != right[exp].keys(): |
27 | 27 | raise ValueError("Different Instrumenters") |
28 | 28 | instrumenters = left[exp].keys() |
29 | | - |
| 29 | + |
30 | 30 | for inst in instrumenters: |
31 | 31 | print("\n\tInstrumenter: {}".format(inst)) |
32 | | - if left[exp][inst].keys()!=right[exp][inst].keys(): |
| 32 | + if left[exp][inst].keys() != right[exp][inst].keys(): |
33 | 33 | raise ValueError("Different Iterations") |
34 | 34 | iterations = left[exp][inst].keys() |
35 | 35 | Y_left = [] |
36 | | - Y_right = [] |
| 36 | + Y_right = [] |
37 | 37 | X = [] |
38 | 38 | for it in iterations: |
39 | 39 | left_val = left[exp][inst][it] |
40 | 40 | right_val = right[exp][inst][it] |
41 | | - if len(left_val)!=len(right_val): |
| 41 | + if len(left_val) != len(right_val): |
42 | 42 | raise ValueError("Different Repetitons") |
43 | 43 |
|
44 | 44 | Y_left.append(numpy.mean(left_val)) |
|
48 | 48 | if args.s: |
49 | 49 | print("\t\tInterations {}".format(it)) |
50 | 50 | print("\t\tMean: {:>7.4f} s {:>7.4f} s".format(numpy.mean(left_val), numpy.mean(right_val))) |
51 | | - print("\t\tMedian: {:>7.4f} s {:>7.4f} s".format(numpy.quantile(left_val, 0.50), numpy.quantile(right_val, 0.50))) |
52 | | - print("\t\t5%: {:>7.4f} s {:>7.4f} s".format(numpy.quantile(left_val, 0.05), numpy.quantile(right_val, 0.05))) |
53 | | - print("\t\t95%: {:>7.4f} s {:>7.4f} s".format(numpy.quantile(left_val, 0.95), numpy.quantile(right_val, 0.95))) |
54 | | - Y_left = numpy.asarray(Y_left,dtype=float).flatten() |
55 | | - Y_right = numpy.asarray(Y_right,dtype=float).flatten() |
56 | | - X = numpy.asarray(X,dtype=float).flatten() |
| 51 | + print("\t\tMedian: {:>7.4f} s {:>7.4f} s".format( |
| 52 | + numpy.quantile(left_val, 0.50), numpy.quantile(right_val, 0.50))) |
| 53 | + print("\t\t5%: {:>7.4f} s {:>7.4f} s".format( |
| 54 | + numpy.quantile(left_val, 0.05), numpy.quantile(right_val, 0.05))) |
| 55 | + print("\t\t95%: {:>7.4f} s {:>7.4f} s".format( |
| 56 | + numpy.quantile(left_val, 0.95), numpy.quantile(right_val, 0.95))) |
| 57 | + Y_left = numpy.asarray(Y_left, dtype=float).flatten() |
| 58 | + Y_right = numpy.asarray(Y_right, dtype=float).flatten() |
| 59 | + X = numpy.asarray(X, dtype=float).flatten() |
57 | 60 |
|
58 | 61 | cost_left = numpy.polyfit(X, Y_left, 1) |
59 | 62 | cost_right = numpy.polyfit(X, Y_right, 1) |
|
62 | 65 | print("") |
63 | 66 | print("\tSlope {:>7.4f} us {:>7.4f} us".format(cost_left[0] * 1e6, cost_right[0] * 1e6)) |
64 | 67 | print("\tIntercept {:>7.4f} s {:>7.4f} s".format(cost_left[1], cost_right[1])) |
65 | | - |
66 | | - |
67 | | - |
0 commit comments