Files
tso-paper-eval/analysis/values/throughput.py
T
2026-05-27 21:00:28 +02:00

23 lines
832 B
Python

"""Throughput per (experiment, solution): mean and sample SD in Gbps."""
from pathlib import Path
import pandas as pd
def compute(derived: Path) -> tuple[dict[str, str], list[Path]]:
out: dict[str, str] = {}
sources: list[Path] = []
for exp_dir in sorted(p for p in derived.iterdir() if p.is_dir()):
runs = exp_dir / "runs.csv"
if not runs.exists():
continue
sources.append(runs)
df = pd.read_csv(runs)
for sol, sub in df.groupby("solution", sort=True):
thr = sub["throughput_bps"].to_numpy() / 1e9
base = f"{exp_dir.name}/throughput/{sol}"
out[f"{base}/mean-gbps"] = f"{thr.mean():.3f}"
out[f"{base}/sd-gbps"] = f"{thr.std(ddof=1):.3f}"
out[f"{base}/n-runs"] = str(len(thr))
return out, sources