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
Provenance
- Commit
8fff864- Tree
dfdcb88- Author
sharkdp <davidpeter@web.de>- Committer
sharkdp <davidpeter@web.de>- Parent
a870d4d
5 files changed+23 added−17 removed
modified:scripts/advanced_statistics.py+4 added-2 removed
29 unmodified lines30 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 lines17 18 commands = [b["command"] for b in results]19 all_times = [b["times"] for b in results]20 21+plt.hist(21-plt.hist(all_times,22- label=commands,23- bins="auto",24- histtype="bar",25- range=(np.min(all_times), np.max(all_times)))26-plt.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+)28+plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})29 30 plt.xlabel("Time [s]")31 if args.title:32 plt.title(args.title)2 unmodified linesmodified:scripts/plot_parametrized.py+7 added-6 removed
7 unmodified lines8 import matplotlib.pyplot as plt9 10 parser = argparse.ArgumentParser(description=__doc__)11 parser.add_argument("file", help="JSON file with benchmark results", nargs="+")12-parser.add_argument("--parameter-name", metavar="name", type=str,13- help="Name of the parameter / x-axis label")12+parser.add_argument(13+ "--parameter-name",14+ metavar="name",15+ type=str,16+ help="Name of the parameter / x-axis label",17+)18 args = parser.parse_args()19 20 for filename in args.file:21 with open(filename) as f:2 unmodified lines24 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]27 24- 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)29 30 plt.xlabel(args.parameter_name)31 plt.ylabel("Time [s]")32 plt.ylim(0, None)1 unmodified linemodified:scripts/plot_whisker.py+3 added-1 removed
13 unmodified lines14 15 parser = argparse.ArgumentParser(description=__doc__)16 parser.add_argument("file", help="JSON file with benchmark results")17 parser.add_argument("--title", help="Plot Title")18-parser.add_argument("--labels", help="Comma-separated list of entries for the plot legend")18+parser.add_argument(19+ "--labels", help="Comma-separated list of entries for the plot legend"20+)21 args = parser.parse_args()22 23 with open(args.file) as f:24 results = json.load(f)["results"]19 unmodified linesmodified:scripts/welch_ttest.py+1 added-2 removed
31 unmodified lines32 print("t = {:.3}, p = {:.3}".format(t, p))33 print()34 35 if 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))37 else:38 print("The two benchmarks are almost the same (p >= {}).".format(th))