Repository navigation
Do not draw the mean-precision rule beyond 100x the acquired objects (fixes #646) - #654
Conversation
…(646)
When the rule asks for more than RULE_DRAW_LIMIT (100) times the objects a group
acquired, the row is not assessable, with the numbers said ("the rule asks for N
cells, X times the M acquired"), and no whole fields are drawn. On the v27 export a
DrugA field raised by 100 over a control mean of 0.25 asked for 11 and 45 million
cells and drew them for more than 15 minutes; it now takes under a second. Rows at
or below the limit are drawn exactly as before.
The draws move to their own private module, _whole_field_draws, since object_rules
was near the 600-line limit. Tests at, just below and just above the limit, and on
the v27 outlier with a time bound.
Fixes 646. Refs 501.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Whole suite run locally after merge, on The one failure has nothing to do with these changes. It is about the machine: GitHub Actions also ran on both PRs: 🤖 Generated with Claude Code |
Definitive timing (quiet machine, 2026-11-29)One process pinned to one core,
Draw helper alone, best of 5 (5 fields of 2 objects, one outlier sum):
The identical-output change alone takes the 646 case from 33 to 19 minutes. The draw limit is what brings it down to under half a second. |
Fixes #646. Refs #501. Follows #653 (the chunked draws, identical outputs, merged), which this builds on.
What
When the mean-precision rule asks for more than
RULE_DRAW_LIMIT(100, set by the owner on 2026-11-28) times the objects a group acquired, that group and target's row ofobject_rule_checkis not assessable and no whole fields are drawn:The ratio is rounded up to one decimal, so it never reads as the limit itself. The row goes through the existing "not assessable" path: a⚠️ line in the summary, like the zero-reference and too-few-fields rows. At the limit itself the draws still run. Every other row, and every row of other groups and targets, is drawn exactly as before (each group and target has its own seeded generator).
The draws move from
object_rules.py, which was at 584 lines out of the 600 allowed, into a new private modulesampling_unit/_whole_field_draws.py(fovs_until,beyond_draw_limit,RULE_DRAW_LIMIT), listed in AGENTS.md section 7.Why
The v27 export with a DrugA field raised by 100: the control mean of repeat rep1 is 0.25, so the rule asks for 11 and 45 million cells (targets 5% and 2.5%), drawn 4,000 times each. That took more than 15 minutes, linear in
n, with no message. The sameobject_rule_checknow returns in well under a second.Tests (
tests/test_object_rules.py)test_the_rule_is_drawn_up_to_the_limit_and_not_beyond[-1, 0, 1]: the limit, just below it and just above it; the exact message above it.test_an_outlier_field_over_a_small_control_mean_is_not_drawn_for_minutes: the v27 outlier case. Both DrugA rep1 targets are skipped with numbers above the limit, every drawn row is within it, and the call finishes under a 30 s bound (it took more than 15 minutes before).fovs_until.Local gate (on 81f574b)
Also run:
ruff checkandruff format --checkonsrc tests data(clean), andtests/test_contracts.pyandtests/test_docs.pywith the guards on the previous commit of this branch (944 passed).Reference check: 0 differences
data/reference/reference.py runon this branch (--parallel 2 --skip idr, 55 jobs, all exit 0), compared with theorigin/mainrun of #653 using the fixed comparer: 0 differences. No group in the repository's data reaches the limit, so outputs change only where the rule asks for more than 100 times the objects acquired. The IDR job was skipped because it uses every CPU.Not run: the whole suite (
pyteston every CPU). It waits until another session's large end-to-end job on this machine has finished.🤖 Generated with Claude Code