diff --git a/scripts/welch_ttest.py b/scripts/welch_ttest.py index ace25a2..d8a8097 100755 --- a/scripts/welch_ttest.py +++ b/scripts/welch_ttest.py @@ -2,15 +2,20 @@ import argparse import json +import sys from scipy import stats parser = argparse.ArgumentParser() -parser.add_argument("file", help="JSON file with benchmark results") +parser.add_argument("file", help="JSON file with two benchmark results") args = parser.parse_args() with open(args.file) as f: results = json.load(f)["results"] +if len(results) != 2: + print("The input file has to contain exactly two benchmarks") + sys.exit(1) + a, b = [x["command"] for x in results[:2]] X, Y = [x["times"] for x in results[:2]] @@ -25,4 +30,4 @@ print("p < {} = {}\n".format(th, dispose)) if dispose: print("There is a difference between the two benchmarks.") else: - print("The two benchmarks are almost the same.") \ No newline at end of file + print("The two benchmarks are almost the same.")