|
5 | 5 | import pandas as pd
|
6 | 6 | import seaborn as sns
|
7 | 7 |
|
8 |
| -json_path = os.environ.get("BENCHMARK_DATA", "benchmark_data") |
| 8 | +data_path = os.environ.get("BENCHMARK_DATA", "benchmark_data") |
9 | 9 | plot_path = os.environ.get("BENCHMARK_PLOT", "benchmark_plot.png")
|
10 |
| - |
11 | 10 | xy = os.environ.get("XY", "unknown")
|
12 | 11 |
|
13 |
| -# s3+hdf5, s3+tiff, s3+zarr, remote+hdf5, remote+… so I’d color by tiff/hdf5/zarr |
14 |
| - |
15 |
| -print("base_path", json_path) |
16 |
| - |
17 |
| - |
18 |
| -three_col = [] |
19 |
| -two_col = [] |
20 |
| - |
21 |
| -test_repeats = int(os.getenv("TEST_REPEATS", "1")) |
22 |
| -json_files = ["%s_benchmark_data.json" % r for r in range(test_repeats)] |
23 |
| -print("json_files", json_files) |
24 |
| - |
25 |
| -for root, dirs, files in os.walk(json_path): |
26 |
| - for file_name in files: |
27 |
| - if file_name in json_files: |
28 |
| - path = os.path.join(root, file_name) |
29 |
| - print("json path", path) |
30 |
| - with open(path) as json_file: |
31 |
| - benchmarks = json.load(json_file)["benchmarks"] |
| 12 | +csv = pd.read_csv(f"{data_path}/0_benchmark_data.csv") |
32 | 13 |
|
33 |
| - for bm in benchmarks: |
34 |
| - m = re.match(r"test_(1_byte|\w+)_(\w+)\[(\w+)\]", bm["name"]) |
35 |
| - if not m: |
36 |
| - raise Exception(bm["name"]) |
37 |
| - typ = m.group(1).replace("1_byte", "overhead") |
38 |
| - src = m.group(3) |
39 |
| - |
40 |
| - if typ == "overhead" and src == "local": |
41 |
| - # 10e-5 skews the view. |
42 |
| - continue |
43 |
| - |
44 |
| - if test_repeats == 1: |
45 |
| - # Ran tests once: plot every data point |
46 |
| - vals = bm["stats"]["data"] |
47 |
| - for run, val in enumerate(vals): |
48 |
| - three_col.append( |
49 |
| - {"type": typ, "source": src, "seconds": val} |
50 |
| - ) |
51 |
| - two_col.append({"name": f"{typ}-{src}", "seconds": val}) |
52 |
| - else: |
53 |
| - # Repeats: take mean value from each |
54 |
| - val = bm["stats"]["mean"] |
55 |
| - three_col.append({"type": typ, "source": src, "seconds": val}) |
56 |
| - two_col.append({"name": f"{typ}-{src}", "seconds": val}) |
57 |
| - |
58 |
| -df3 = pd.DataFrame.from_dict(three_col) |
59 |
| -df2 = pd.DataFrame.from_dict(two_col) |
60 |
| - |
61 |
| -types = ("overhead", "zarr", "tiff", "hdf5") |
| 14 | +types = ("Overhead", "Zarr", "TIFF", "HDF5") |
62 | 15 | sources = ("local", "http", "s3")
|
63 | 16 | orders = {"type": types, "source": sources}
|
64 | 17 |
|
65 | 18 | pal_points = "colorblind"
|
66 | 19 | pal_violins = "pastel"
|
67 | 20 |
|
68 | 21 | g = sns.FacetGrid(
|
69 |
| - df3, col="source", col_order=sources, sharey=False, height=5, aspect=0.6, |
| 22 | + csv, |
| 23 | + col="source", |
| 24 | + col_order=sources, |
| 25 | + sharey=False, |
| 26 | + height=5, |
| 27 | + aspect=0.6, |
70 | 28 | )
|
71 | 29 |
|
72 | 30 | g = g.map(
|
|
83 | 41 |
|
84 | 42 | g = g.map(
|
85 | 43 | sns.stripplot,
|
86 |
| - "type", |
| 44 | + "type", # was type |
87 | 45 | "seconds",
|
88 | 46 | dodge=True,
|
89 | 47 | order=types,
|
|
93 | 51 | )
|
94 | 52 |
|
95 | 53 | g.despine(left=True)
|
96 |
| -g.set(yscale="log", ylim=(0.0009, 1)) |
| 54 | +g.set(yscale ='log', ylim=(0.0009, 1)) |
97 | 55 |
|
98 | 56 | # Set axis labels & ticks #
|
99 | 57 | for ax in g.fig.get_axes():
|
|
105 | 63 | # Remove outline of violins
|
106 | 64 | col.set_edgecolor("white")
|
107 | 65 |
|
| 66 | +# Only show on far left plot |
108 | 67 | g.fig.get_axes()[0].set_ylabel("Seconds")
|
109 | 68 | g.fig.get_axes()[0].spines["left"].set_visible(True)
|
110 | 69 |
|
| 70 | +# Add annotations |
| 71 | +g.fig.get_axes()[0].text(0.0001, 0.001, "off-\nscale") |
| 72 | + |
111 | 73 | g.savefig(plot_path, dpi=600)
|
0 commit comments