Add trace_agg/src/trace_agg/cli.py
This commit is contained in:
parent
b67c835241
commit
65bfe40bf9
1 changed files with 32 additions and 0 deletions
32
trace_agg/src/trace_agg/cli.py
Normal file
32
trace_agg/src/trace_agg/cli.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from trace_agg.core import aggregate_em_data
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Aggregiert EM-Tracedaten und berechnet Summary-Metriken.")
|
||||||
|
parser.add_argument("--input", required=True, help="Pfad zur Eingabe-CSV-Datei mit EM-Traces.")
|
||||||
|
parser.add_argument("--output", required=True, help="Pfad zur JSON-Datei mit den Ergebnissen.")
|
||||||
|
parser.add_argument("--num-trials", type=int, default=None, help="Anzahl der Trials, die aggregiert werden sollen.")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
input_path = Path(args.input)
|
||||||
|
output_path = Path(args.output)
|
||||||
|
|
||||||
|
if not input_path.exists() or not input_path.is_file():
|
||||||
|
print(f"Eingabedatei nicht gefunden: {input_path}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
results = aggregate_em_data(num_trials=args.num_trials)
|
||||||
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with open(output_path, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(results, f, indent=2)
|
||||||
|
print(f"Aggregation beendet. Ergebnisse gespeichert in {output_path}.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Fehler bei der Aggregation: {e}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Loading…
Reference in a new issue