def run(self): results_path = Path(str(directives.path(self.arguments[0]))) if not results_path.is_absolute(): source = str(self.state_machine.input_lines.source(self.lineno - self.state_machine.input_offset - 1)) results_path = Path(source).resolve().parent().join(results_path) results = load_benchmarks(results_path) for result in results: self.state.document.settings.record_dependencies.add(result["sphinx_benchmark_path"]) headers = ["Label", "Datetime", "Angles", "Scales", "Mean Correlation"] data = [self.extract_result(r) for r in results] return [self.create_table([headers] + data)]
import matplotlib.pyplot as pyplot import numpy from pathlib import Path from benchmark_loader import load_benchmarks results = load_benchmarks(Path("../benchmark").resolve()) indices = numpy.arange(len(results)) labels = [r.get("label", "") for r in results] mean_correlations = [r["mean_correlation"] for r in results] colors = [r["plot_color"] for r in results] pyplot.gcf().set_size_inches((12, 12), forward=True) pyplot.ylabel("Mean Correlation to User Study") pyplot.xticks(indices + 0.4, labels, rotation=90) pyplot.bar(indices, mean_correlations, color=colors) pyplot.tight_layout() pyplot.show()