diff options
| author | RncLsn <rnc.lsn@gmail.com> | 2015-07-06 15:07:13 +0100 |
|---|---|---|
| committer | RncLsn <rnc.lsn@gmail.com> | 2015-07-06 17:52:28 +0100 |
| commit | c493035e37fa0071e2ca5f973ccf895d16adce09 (patch) | |
| tree | 70d73570fa49570a27d6a8996fc8b79df8204f35 | |
| parent | 39b60d4225f5efa4e0287a2c6ce69d90391c69db (diff) | |
| download | ACQuA-c493035e37fa0071e2ca5f973ccf895d16adce09.tar.gz ACQuA-c493035e37fa0071e2ca5f973ccf895d16adce09.zip | |
Added script for plotting times.
| -rw-r--r-- | scripts/plottimes.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/plottimes.py b/scripts/plottimes.py new file mode 100644 index 0000000..8c5b433 --- /dev/null +++ b/scripts/plottimes.py | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | import sys | ||
| 2 | import numpy as np | ||
| 3 | import matplotlib.pyplot as plt | ||
| 4 | import json | ||
| 5 | |||
| 6 | MISSING_VALUE = -100 | ||
| 7 | |||
| 8 | def 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 | |||
| 17 | def get_list_from_data(data): | ||
| 18 | return sorted([(int(x), float(data[x]['totalTime'])) for x in [y for y in data]]) | ||
| 19 | |||
| 20 | def main(input_filename_1, input_filename_2): | ||
| 21 | |||
| 22 | with open(input_filename_1, 'r') as f: | ||
| 23 | data_1 = json.load(f) | ||
| 24 | |||
| 25 | with open(input_filename_2, 'r') as f: | ||
| 26 | data_2 = json.load(f) | ||
| 27 | |||
| 28 | max_value = max([int(x) for x in data_1] + [int(x) for x in data_2]) | ||
| 29 | |||
| 30 | times_1 = fill(get_list_from_data(data_1)) | ||
| 31 | times_2 = fill(get_list_from_data(data_2)) | ||
| 32 | |||
| 33 | x = np.array(zip(*times_1)[0]) | ||
| 34 | y_1 = np.array(zip(*times_1)[1]) | ||
| 35 | y_2 = np.array(zip(*times_2)[1]) | ||
| 36 | colors_1 = '#eeefff' | ||
| 37 | colors_2 = '#11ee55' | ||
| 38 | |||
| 39 | # plt.axvline([i for i in range(max_value)], color='k', linestyle='solid') | ||
| 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() | ||
| 44 | plt.show() | ||
| 45 | |||
| 46 | |||
| 47 | if __name__ == '__main__': | ||
| 48 | main(sys.argv[1], sys.argv[2]) \ No newline at end of file | ||
