Skip to main content
scripts/export_results.py · chapter The batch event study, file 5 · 331 lines · open in the repository

What it does

Gather the final results into docs/results/ for the report, the slides and the video (decision 0013). Everything a teammate needs to write about the results, without running anything: every number with where it comes from, the tables, the charts, and the full output of the checks that prove the stream is right. The numbers are written by this script from the run’s outputs, so the summary cannot drift from them. Run after a full run (./run_everything.sh) and python3 src/hosting/snapshot.py:
With the SFU cluster run copied back to data/cluster/stream (see AGENTS.md, Commands):
Writes (committed; small): docs/results/README.md the results, section by section, with tables and charts docs/results/tables/.csv the batch study’s summary and trend tables, the model’s metrics docs/results/charts/.png the report’s charts docs/results/checks/*.txt the full output of check_streaming.py and compare_stream_batch.py

What is inside

  • OUT · line 42
  • TABLES · line 43
  • CHARTS · line 44: file: caption
  • LINK_NAMES · line 53
  • pct(v, digits) · line 57
  • p(v) · line 64
  • stars(pv) · line 68
  • run_check(args, name) · line 72: Run a check script, keep its full output in docs/results/checks/, return (ok, output).
  • lines_with(text) · line 83
  • in_window_rates(signals, cars) · line 87: Share of stock-days with an abnormal return or an attention spike, inside event windows (days −5..+5) and outside them.
  • main() · line 103

Connections

Uses: src/common/contracts.py, src/common/settings.py, src/common/study.py, src/eventstudy/car.py, src/eventstudy/charts.py, src/eventstudy/stats.py, src/hosting/snapshot.py

Source

scripts/export_results.py