Skip to content

feat(analysis): step 6 phase 2/3 — EF diagnostics compile + plot scripts#379

Merged
MoLi7 merged 2 commits into
mainfrom
mo__step6-ef-diagnostics
May 12, 2026
Merged

feat(analysis): step 6 phase 2/3 — EF diagnostics compile + plot scripts#379
MoLi7 merged 2 commits into
mainfrom
mo__step6-ef-diagnostics

Conversation

@MoLi7

@MoLi7 MoLi7 commented May 5, 2026

Copy link
Copy Markdown
Member

cc:
Closes:

What changed? Why?

Step 6 / Phase 2 + Phase 3 of epic #337. Two new scripts under bedrock/analysis/a_matrix_time_series/:

  • compile_ef_diagnostics.py — reads output/results/ef_run_index.csv for the (approach, baseline, sheet_id) triples produced by Phase 1 diagnostics runs. Pulls N_and_diffs and D_and_diffs from each Sheet via read_sheet_tab, joins them on the sector index, and writes:
    • output/results/ef_comparison.xlsx — one tab per (approach, baseline) plus summary_vs_ceda / summary_vs_useeio (per-approach p50 / p95 / max of |N_perc_diff| and |D_perc_diff| plus n_significant at a 10% threshold).
    • output/results/ef_scatter_coords.parquet — long-format (approach, baseline, ef_kind, sector, x_baseline, y_approach) for Phase 3.
    • Appends ef_summary_vs_* tabs to the run-report Sheet (sheet ID from last_run_sheet_id.txt); skipped with a warning if missing.
  • plot_ef_diagnostics.py — reads the parquet from above and produces, for each (baseline, ef_kind) pair, two 2×2 figures: scatter (ef_scatter_{baseline}_{ef_kind}.png) and per-sector %-diff histogram (ef_pct_hist_{baseline}_{ef_kind}.png). Histograms mirror the baseline_snapshot_comparison/compare_B_Adom convention: ±100% clip, 60 bins, vertical zero line, consistent xlim across panels and figures.

Stop tracking the two embedded-headline PNGs that earlier PRs (#364, #365) force-added past the *.png gitignore (keysector_impact_heatmap.png, summary_a_rmse_ranking.png). They were tracked because of the embedded-PR-body pattern but kept dirtying git status after every Step 4/5 re-run. With them removed, every plot in the analysis dir is now treated as output.

Testing

  • Ran both scripts end-to-end against 7 real diagnostics Sheets in the v0.3 Diagnostics Drive folder; outputs match expected schema.
  • black --check, ruff check ., mypy bedrock (384 files) all clean.

MoLi7 commented May 5, 2026

Copy link
Copy Markdown
Member Author

@WesIngwersen

WesIngwersen commented May 6, 2026

Copy link
Copy Markdown
Member

I can't find the script that compiles ef_run_index.csv which is read from. It's giving me an error suggesting I prepare one manually but that doesn't make a lot of sense that it would have to be prepared manually and it does not give enough guidance on how to do so.

FileNotFoundError: {my local path}bedrock\bedrock\analysis\a_matrix_time_series\output\results\ef_run_index.csv not found — populate it by hand from the Phase 1 diagnostics runs (one row per (approach, baseline) Sheet).

@MoLi7

@MoLi7

MoLi7 commented May 6, 2026

Copy link
Copy Markdown
Member Author

I can't find the script that compiles ef_run_index.csv which is read from. It's giving me an error suggesting I prepare one manually but that doesn't make a lot of sense that it would have to be prepared manually and it does not give enough guidance on how to do so.

FileNotFoundError: {my local path}bedrock\bedrock\analysis\a_matrix_time_series\output\results\ef_run_index.csv not found — populate it by hand from the Phase 1 diagnostics runs (one row per (approach, baseline) Sheet).

@MoLi7

@WesIngwersen I pushed rebuild_run_index_from_drive.py in 81eed45 that lists the GSheets in our diagnostics Drive folder, parses each title, and writes ef_run_index.csv. You can run it without re-dispatching and re-generating all EF diagnostics:
python -m bedrock.analysis.a_matrix_time_series.rebuild_run_index_from_drive --folder-id <DRIVE_FOLDER_ID>

The folder ID is the part after /folders/ in your Drive URL.

@WesIngwersen WesIngwersen removed their request for review May 6, 2026 21:40
MoLi7 and others added 2 commits May 11, 2026 09:59
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds rebuild_run_index_from_drive.py — lists Google Sheets in a
diagnostics Drive folder and parses each title into (approach, baseline,
sheet_id, year?, scenario?) rows for ef_run_index.csv. Closes the manual-
flow gap: users who triggered diagnostics via the GH Actions UI can now
auto-build the run index instead of hand-typing sheet IDs.

Title regex handles both formats currently in use:
  Manual:    [DATE, BASELINE based, A matrix with APPROACH] EFs diagnostics
  Dispatch:  [DATE, YEAR, BASELINE based, A matrix with APPROACH, SCENARIO] EFs diagnostics

Also rewords the FileNotFoundError in compile_ef_diagnostics.py to point
at the new script as the auto-rebuild path, with hand-write as a
fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MoLi7 MoLi7 merged commit 2ac5a17 into main May 12, 2026
5 checks passed
@MoLi7 MoLi7 deleted the mo__step6-ef-diagnostics branch May 12, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants