With the frame's curve in use (D5: stills, and rotation runs whose empty apertures ask for it) the
correction was a precomputed annulus-minus-disk kernel over radial offset, applied to the curve at the
reflection's distance from the PONI. The empty apertures that decide it compute the same quantity over
the pixels they actually read, at each pixel's own 2 theta. The two differ exactly next to the beam stop:
the ring's beam-side pixels are masked by the shadow, but the kernel still averaged the curve over them
(the curve there holds the shadow's edge, a cliff of several hundred counts), and on a tilted detector
the PONI is a few pixels from where the beam lands, where the curve is steepest. On a binned-Rayonix
still run with the beam stop off the beam this sent low-resolution reflections next to the stop to large
negative intensities (median -854 -> -4171 at 42-50 px), destabilised the per-image scales and collapsed
the lowest shell's CC1/2 (0.906 -> 0.448, "not usable" warning).
Now, where the frame's curve is in use:
- the correction is the curve's mean over the ring pixels the background was taken from (after the
clip) minus its mean over the readable disk pixels (BraggCurveCorrection), summed in pass A while the
box is read anyway - in fixed point (1/256 count), so CPU and GPU sums are exact and order-independent;
- the curve is read at the 2 theta of the reflection's position (CurveRadius, from the geometry), the
radius it is tabulated against, and the clip offset follows it there;
- BackgroundAperture takes the curve's mean over the ring pixels the clip kept, so the decision
measures exactly what is applied.
The kernel stays for the curve accumulated from the reflections' rings (rotation's per-image ice gate),
unchanged. Metal unchanged (it hands such frames to the CPU engine).
Validation. Rotation, CPU A/B vs 87684012f over 18 sets: .hkl byte-identical on the 12 sets where D5 is
off (and on the 3 ice-gated D14 sets identical to D5); the three D5-on sets improve: a home-source CCD
set R-free 0.210 -> 0.194 (D5 0.201), ISa 10.4 -> 10.8, anomalous 3.70 -> 3.94; the ice set
0.315 -> 0.312, ISa 22.3 -> 22.7 (D5 lost ISa there); the third neutral. Stills (0-cycle REFMAC, 9 sets):
R-free within +0.0021/-0.0039 of 87684012f on every set, verdicts unchanged except one draw -> win,
no "not usable" warning on any set (two base runs had one). The lowest shell's CC1/2 on the run above
stays low (0.44): it is set by three to five reflections at 30-41 A in the penumbra of the stop, which
integrate as garbage with every variant (the uncorrected run included); with the merge's low-resolution
limit at 30 A it reads 0.79.
Tests: BraggIntegrationEngineCPU_RadialCurveOverThePixelsRead (shadow edge on a tilted detector; fails
with the kernel or with the PONI radius), the GPU parity test now with a masked ring.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit d225b546c613ab2266c63ff2add02624b04d5e25)