beam-centre rescue: a rung is scored at its own centre, and not adopted on a harmonic

The ladder set a trial centre and then scored it on spots found at the starting
centre. Raw centroids do not move with the beam centre, but which spots are in
the list does: the resolution limit, the ice-ring flag, the beam-stop mask and
the strongest-N ranking are all computed against a radius. Every rung was
therefore judged on the starting centre's evidence, and the count it produced
was not a function of the centre it named.

A trial centre now gets its own azimuthal mapping, spot engines and spot cache;
the starting centre's cache is parked and restored, so a ladder that adopts
nothing leaves the run exactly as it was. Measured against standalone runs
pinned at the same centres, the ladder's score goes from a mean absolute error
of 21.8 validation frames to 0.43, and at nine pinned centres the patched and
unpatched binaries agree exactly - the change is confined to the ladder.

Scoring honestly is not by itself an improvement: with the count honest, one
crystal adopted a rung at a real 56/60 whose cell is a four-fold axis harmonic
of the standing one, and merged the supercell. A longer cell indexes more,
which is why the harmonic arbiter exists elsewhere in this file. A rung whose
primitive volume is an integer or sqrt(3) multiple of the standing cell is now
refused, and that crystal walks past both harmonics to a 60/60 rung.

Over a hundred rotation datasets no space group, cell or run status changes.
Eight merges move: one gains 126 per cent of its unique reflections, one 3.7,
five move by less than half a per cent, and one loses 3.2 - that last was
attributed separately and is the difference between two failed merges, both
peaking at a half-dataset correlation of 5 per cent, with the honest run the
slightly better of the two. Wall time rises 1.7 per cent, the cost of finding
spots again at each trial centre.

On a corpus processed from a deliberately destroyed beam centre the same change
recovers eight datasets outright on their deposited space group and cell,
restores a ninth's space-group call by returning its axial absence counts to the
values the correct geometry gives, and withdraws one adoption that had shipped a
wrong cell in the wrong crystal system at a half-dataset correlation of 0.10.

Note that only the spot-cache half of this does the work. Reading the indexer's
geometry per call rather than from construction was measured to change nothing
on a rotation ladder, because the per-frame validation dispatches to a path that
takes its geometry from the forced indexer result; it is kept because the copy
was misleading to read, not because it moves a number.
This commit is contained in:
leonarski_f committed 2026-09-13 07:36:48 +02:00
1 parent 7a62032765
commit 3d9c8b878b
3 files changed
+77 -13

No files matched your search

+8 -3
View File
@@ -67,7 +67,6 @@ IndexAndRefine::IndexAndRefine(const DiffractionExperiment &x, IndexerThreadPool
: retain_outcomes_(retain_outcomes),
real_time(real_time),
experiment(x),
geom_(x.GetDiffractionGeometry()),
indexer_(indexer),
rotation_indexer_counter(x) {
if (indexer && x.IsRotationIndexing())
@@ -161,12 +160,18 @@ IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetry(Data
// Read per call rather than cached at construction: the run measures for itself whether the
// crystal has ice, and that verdict lands after this object is built.
const bool index_ice_rings = experiment.GetIndexingSettings().GetIndexIceRings();
// Read per call, for the same reason: a beam-centre hypothesis moves the geometry after this
// object is built, and a spot mapped into reciprocal space through the centre the run started at
// is not the spot the trial centre sees. Held at construction, this scored every hypothesis of the
// beam-centre ladder against the file's geometry - which is why a centre scored 42/60 inside the
// ladder and 5/60 when the same value was given on the command line.
const DiffractionGeometry geom = experiment.GetDiffractionGeometry();
for (size_t seed_cap : {size_t{30}, size_t{80}, std::numeric_limits<size_t>::max()}) {
std::vector<Coord> recip;
recip.reserve(std::min<size_t>(seed_cap, msg.spots.size()));
for (const auto &i: msg.spots) {
if (index_ice_rings || !i.ice_ring) {
recip.push_back(i.ReciprocalCoord(geom_));
recip.push_back(i.ReciprocalCoord(geom));
if (recip.size() >= seed_cap)
break;
}
@@ -223,7 +228,7 @@ IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetry(Data
recip.reserve(std::min<size_t>(msg.spots.size(), FFT_MAX_SPOTS));
for (const auto &i : msg.spots) {
if (index_ice_rings || !i.ice_ring) {
recip.push_back(i.ReciprocalCoord(geom_));
recip.push_back(i.ReciprocalCoord(geom));
if (recip.size() >= FFT_MAX_SPOTS)
break;
}