raster_highest_score now falls back to the geometric grid centre when the
grid is too weak to contain a crystal, instead of collecting at the noisy argmax
cell. So a "nothing in the loop" result is centred and deliberate rather than
data collected on noise.
Guard: route to centre when the grid-wide maximum spots_low_res is below
min_low_res_spots (default 10.0, exposed as a tunable parameter).
spots_indexed is deliberately NOT part of the guard: indexing was dropped from
the crystal score on main (w_indexed=0.00), so a crystal that diffracts but
fails to index must still be targeted, not routed to centre. This resolves the
earlier open question about the OR rule -- the indexed clause is gone.
Returns a CenterOfMassModel at the centre (not None), so both DAQ call sites
work unchanged -- the simulated branch (no None check) and the real branch (its
existing None-fallback simply stays dead). No AareDAQ change required.
Single file touched: src/aarecommon/math/find_xtal.py.
Test
uv run python src/aarecommon/math/find_xtal.py prints find_xtal self-check passed
(crystal maps to best cell; all-noise maps to centre; strong-spots-but-unindexed
maps to the best cell, indexing does not veto).
Generated with Claude Code.
Closes #10.
## What
raster_highest_score now falls back to the geometric **grid centre** when the
grid is too weak to contain a crystal, instead of collecting at the noisy argmax
cell. So a "nothing in the loop" result is centred and deliberate rather than
data collected on noise.
Guard: route to centre when the grid-wide maximum spots_low_res is below
min_low_res_spots (default 10.0, exposed as a tunable parameter).
spots_indexed is deliberately NOT part of the guard: indexing was dropped from
the crystal score on main (w_indexed=0.00), so a crystal that diffracts but
fails to index must still be targeted, not routed to centre. This resolves the
earlier open question about the OR rule -- the indexed clause is gone.
Returns a CenterOfMassModel at the centre (not None), so both DAQ call sites
work unchanged -- the simulated branch (no None check) and the real branch (its
existing None-fallback simply stays dead). No AareDAQ change required.
Single file touched: src/aarecommon/math/find_xtal.py.
## Test
uv run python src/aarecommon/math/find_xtal.py prints find_xtal self-check passed
(crystal maps to best cell; all-noise maps to centre; strong-spots-but-unindexed
maps to the best cell, indexing does not veto).
Generated with Claude Code.
raster_highest_score always returns the argmax cell, which lands on
noise when the loop has no crystal. Add a grid-wide weakness guard:
when max(spots_low_res) < min_low_res_spots OR max(spots_indexed) <
min_spots_indexed, return a CenterOfMassModel at the geometric grid
centre instead of collecting at a noisy cell. Thresholds are tunable
parameters (defaults 10.0 and 1).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Indexing was removed from the crystal score (w_indexed=0.00), so it must
not act as a hard veto either: a crystal that diffracts but fails to
index should still be targeted, not routed to grid centre. Guard now
checks max spots_low_res only.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
duan_j
marked the pull request as ready for review 2026-07-28 14:01:16 +02:00
duan_j
changed title from Update find_xtal.py post-scan collection position logic (#10) to fix: Update find_xtal.py post-scan collection position logic (#10)2026-07-28 14:01:24 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #10.
What
raster_highest_score now falls back to the geometric grid centre when the
grid is too weak to contain a crystal, instead of collecting at the noisy argmax
cell. So a "nothing in the loop" result is centred and deliberate rather than
data collected on noise.
Guard: route to centre when the grid-wide maximum spots_low_res is below
min_low_res_spots (default 10.0, exposed as a tunable parameter).
spots_indexed is deliberately NOT part of the guard: indexing was dropped from
the crystal score on main (w_indexed=0.00), so a crystal that diffracts but
fails to index must still be targeted, not routed to centre. This resolves the
earlier open question about the OR rule -- the indexed clause is gone.
Returns a CenterOfMassModel at the centre (not None), so both DAQ call sites
work unchanged -- the simulated branch (no None check) and the real branch (its
existing None-fallback simply stays dead). No AareDAQ change required.
Single file touched: src/aarecommon/math/find_xtal.py.
Test
uv run python src/aarecommon/math/find_xtal.py prints find_xtal self-check passed
(crystal maps to best cell; all-noise maps to centre; strong-spots-but-unindexed
maps to the best cell, indexing does not veto).
Generated with Claude Code.
cad77d4cf1toe4e4a44868Update find_xtal.py post-scan collection position logic (#10)to fix: Update find_xtal.py post-scan collection position logic (#10)This one is ready to merge too...should go to the grid center for data collection when there is nothing in the grid