aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/plottimes.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/scripts/plottimes.py b/scripts/plottimes.py
index 767374f..8c5b433 100644
--- a/scripts/plottimes.py
+++ b/scripts/plottimes.py
@@ -3,6 +3,20 @@ import numpy as np
3import matplotlib.pyplot as plt 3import matplotlib.pyplot as plt
4import json 4import json
5 5
6MISSING_VALUE = -100
7
8def fill(v):
9 i = 0
10 while i < len(v)-1:
11 if v[i][0]+1 != v[i+1][0]:
12 v = v[:i+1] + [(v[i][0]+1, None)] + v[i+1:]
13 i += 1
14 return v
15
16
17def get_list_from_data(data):
18 return sorted([(int(x), float(data[x]['totalTime'])) for x in [y for y in data]])
19
6def main(input_filename_1, input_filename_2): 20def main(input_filename_1, input_filename_2):
7 21
8 with open(input_filename_1, 'r') as f: 22 with open(input_filename_1, 'r') as f:
@@ -11,19 +25,24 @@ def main(input_filename_1, input_filename_2):
11 with open(input_filename_2, 'r') as f: 25 with open(input_filename_2, 'r') as f:
12 data_2 = json.load(f) 26 data_2 = json.load(f)
13 27
14 times_1 = [(x, data_1[x]['totalTime']) for x in sorted([y for y in data_1])] 28 max_value = max([int(x) for x in data_1] + [int(x) for x in data_2])
15 times_2 = [(x, data_2[x]['totalTime']) for x in sorted([y for y in data_2])] 29
16 30 times_1 = fill(get_list_from_data(data_1))
31 times_2 = fill(get_list_from_data(data_2))
32
17 x = np.array(zip(*times_1)[0]) 33 x = np.array(zip(*times_1)[0])
18 y_1 = np.array(zip(*times_1)[1]) 34 y_1 = np.array(zip(*times_1)[1])
19 y_2 = np.array(zip(*times_2)[1]) 35 y_2 = np.array(zip(*times_2)[1])
20 colors_1 = '#eeefff' 36 colors_1 = '#eeefff'
21 colors_2 = '#11ee55' 37 colors_2 = '#11ee55'
22 38
23 plt.scatter(x, y_1, c=colors_1, marker=',') 39 # plt.axvline([i for i in range(max_value)], color='k', linestyle='solid')
24 plt.scatter(x, y_2, c=colors_2, marker='v') 40 plt.scatter(x, y_1, c=colors_1, marker=',', s=50)
41 plt.scatter(x, y_2, c=colors_2, marker='v', s=50)
42 plt.xticks(np.arange(1, 21, 1.0))
43 plt.grid()
25 plt.show() 44 plt.show()
26 45
27 46
28if __name__ == '__main__': 47if __name__ == '__main__':
29 main(sys.argv[1], sys.argv[2]) 48 main(sys.argv[1], sys.argv[2]) \ No newline at end of file