Repository navigation
Issue-202: Simulate how many injections a completeness curve needs (V36) - #233
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JoottunAtish
left a comment
There was a problem hiding this comment.
Approving. CI is green, the 6 new tests pass locally, and the script's output on Windows matches the A22.14 table byte for byte (CRLF aside), so the "reproduces byte for byte" condition of #202 now holds on two platforms. The model, the Fisher-scoring fit and the bootstrap are sound: the bands hold the truth 61–75 % of the time against a nominal 68 %, within about 2 SE for 200 repeats. No new dependencies, and the true curves come from the A22.10.4 example.
Decision still needed (not a code change): V36 stays "Proposed: 300; still blocks HN-4" until Kevin or I accept 300 per curve (or set a target band width) and confirm "90 % completeness" means an absolute 0.90.
Nits (non-blocking, can be a follow-up):
docs/architecture/discovery-hunts.md:1038: A22.10.2 still says "150 to 300 injections in the transition … to confirm by a small simulation in HN-4". The script's N is the total per curve (80 % in the rise), and the simulation now lives in A22.14 V36. Suggest: "150 to 300 injections per curve (total; 80 % in the rise), simulated in A22.14 V36".backend/scripts/sim_injection_count.py:165: the RNG key[seed, round(width*1000), round(plateau*1000), n, r]leaves out x50, so two curves that differ only in x50 would share streams. Nothing collides today (all x50 = 1.02). Addround(curve.x50*1000)or the curve's index, then regenerate the table.- The doc table has no regression guard. Optional: a test running
table(repeats=2, bootstraps=20)against a small golden string. sim_injection_count.py:90: the starting grid's widths(0.03, 0.06, 0.12, 0.25)are fixed. Add a comment, or derive them fromWIDTH_BOUNDS.backend/tests/test_sim_injection_count.py:24-28: the monotonicity test compares 150 with 1500, too wide a gap to catch subtle regressions. Optionally also assert that 300 is narrower than 150.
Add x50 to the random stream key and regenerate the V36 table, state the count as a total per curve in A22.10.2, comment the fixed starting widths, compare 300 injections in the monotonicity test and add a golden table row. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the review. All five nits are fixed in b9f13c5:
Your byte-for-byte check on Windows was on the old table; the new one has only been run once, on Linux. Still open, not a code change: accepting 300 per curve (V36 stays Proposed) and reading "90 % completeness" as an absolute 0.90. |
Closes #202
What this adds
backend/scripts/sim_injection_count.py: a fixed-seed simulation. It draws injections from a known 3-parameter logistic in log10 expected S/N, fits it by binomial maximum likelihood (numpyonly, no new dependency), bootstraps the fit, and repeats for 150, 200, 300 and 500 injections.backend/tests/test_sim_injection_count.py: the fit recovers the true parameters on a large sample, the same seed gives the same result, more injections give a narrower band, and one table row matches a golden string.docs/architecture/discovery-hunts.md: the V36 row, the results table and a recommendation.Result
Proposed: 300 injections per curve. Median band width (16th to 84th percentile, completeness units) across the four test curves:
Please check these choices
Limit: injections are placed using the true midpoint and width. A real calibration only has estimates of them, so its bands are likely wider.
Checks
ruff check,ruff format --checkandmypy(on the two changed Python files) pass locally. The rest of the backend tests were not run locally.🤖 Generated with Claude Code