Skip to content
Myr

Auto-format Python scripts

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by sharkdp · parent a870d4d · Browse files · 5 files+23 added−17 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+23 added−17 removed

  • other:+23 added−17 removed

5 files+23 added−17 removed

modified:scripts/advanced_statistics.py+4 added-2 removed
29 unmodified lines
30 print(" max: {:8.3f} s".format(np.max(ts)))31 print()32 print(" percentiles:")33 print(" P_05 .. P_95: {:.3f} s .. {:.3f} s".format(p05, p95))34 print(34 print(" P_25 .. P_75: {:.3f} s .. {:.3f} s "35 "(IQR = {:.3f} s)".format(p25, p75, iqr))35 " P_25 .. P_75: {:.3f} s .. {:.3f} s "36 "(IQR = {:.3f} s)".format(p25, p75, iqr)37 )38 print()
modified:scripts/plot_histogram.py+8 added-6 removed
16 unmodified lines
1718commands = [b["command"] for b in results]19all_times = [b["times"] for b in results]2021plt.hist(21plt.hist(all_times,22 label=commands,23 bins="auto",24 histtype="bar",25 range=(np.min(all_times), np.max(all_times)))26plt.legend(prop={'family': ['Source Code Pro', 'Fira Mono', 'Courier New']})22 all_times,23 label=commands,24 bins="auto",25 histtype="bar",26 range=(np.min(all_times), np.max(all_times)),27)28plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})2930plt.xlabel("Time [s]")31if args.title:32 plt.title(args.title)
2 unmodified lines
modified:scripts/plot_parametrized.py+7 added-6 removed
7 unmodified lines
8import matplotlib.pyplot as plt910parser = argparse.ArgumentParser(description=__doc__)11parser.add_argument("file", help="JSON file with benchmark results", nargs="+")12parser.add_argument("--parameter-name", metavar="name", type=str,13 help="Name of the parameter / x-axis label")12parser.add_argument(13 "--parameter-name",14 metavar="name",15 type=str,16 help="Name of the parameter / x-axis label",17)18args = parser.parse_args()1920for filename in args.file:21 with open(filename) as f:
2 unmodified lines
24 parameter_values = [float(b["parameter"]) for b in results]25 times_mean = [b["mean"] for b in results]26 times_stddev = [b["stddev"] for b in results]2724 plt.errorbar(x=parameter_values,25 y=times_mean,26 yerr=times_stddev,27 capsize=2)28 plt.errorbar(x=parameter_values, y=times_mean, yerr=times_stddev, capsize=2)2930plt.xlabel(args.parameter_name)31plt.ylabel("Time [s]")32plt.ylim(0, None)
1 unmodified line
modified:scripts/plot_whisker.py+3 added-1 removed
13 unmodified lines
1415parser = argparse.ArgumentParser(description=__doc__)16parser.add_argument("file", help="JSON file with benchmark results")17parser.add_argument("--title", help="Plot Title")18parser.add_argument("--labels", help="Comma-separated list of entries for the plot legend")18parser.add_argument(19 "--labels", help="Comma-separated list of entries for the plot legend"20)21args = parser.parse_args()2223with open(args.file) as f:24 results = json.load(f)["results"]
19 unmodified lines
modified:scripts/welch_ttest.py+1 added-2 removed
31 unmodified lines
32print("t = {:.3}, p = {:.3}".format(t, p))33print()3435if dispose:36 print("There is a difference between the "37 "two benchmarks (p < {}).".format(th))36 print("There is a difference between the two benchmarks (p < {}).".format(th))37else:38 print("The two benchmarks are almost the same (p >= {}).".format(th))