Files
Jungfraujoch/docs
leonarski_fandClaude Opus 5 d412306c77 beam stop: a shadow does not have to touch the direct beam
The shadow finder kept only the low region connected to the beam centre, flooding
outward from seeds within 4 px of it. That is written for the beam stop and its
holder arm, an object that touches the direct beam. Hardware that stands in the
beam further out - a pin, a loop - casts a shadow that begins some way out in
radius, with lit detector between it and the stop, and no bridge crosses that gap.
On a sweep where such a shadow covers 38 % of the detector the per-ring test found
the whole of it and connectivity then discarded 950 k pixels, leaving the beam-stop
disk alone; those pixels went into integration as measured-and-near-zero.

What makes the test specific instead is size: keep the connected components that
hold at least MIN_SHADOW_PIXELS core pixels. A shadow is cast by something physical
and is correspondingly large, while the background wanders a pixel or two at a time.
Measured on five clean in-house sweeps spanning 0.05 to 9.5 counts/px/frame of
background, every one returns exactly one such component - the beam stop - and the
largest spurious candidate anywhere is 74 pixels, a 27x margin.

MIN_EXPECTED_COUNTS becomes a Poisson significance. A ratio says nothing when the
background behind it is a handful of photons, so the deficit is now required to be
significant against its own scatter, sqrt(2 (E - N + N ln(N/E))) over the pooled
counts. This is what makes the comparison scale-free rather than tuned to one
exposure: rebuilt from six frames of a low-background sweep, the same thresholds
without it mask three quarters of the detector and with it mask none of it. The
index of dispersion, measured over the frames, does NOT do this job - it is 1.0
inside the shadow and 1.0 outside it, because a shadowed pixel is Poisson at a low
rate and a lit one is Poisson at a high rate. Only the rate relative to the ring
separates them.

The rest follows: the core ratio moves 0.35 -> 0.50 and the half-shadow reach 0.72
within 14 px -> 0.75 within 30 px, since a pin's penumbra is much wider than a beam
stop edge's; the ring walk that finds the rings lying wholly inside the stop keeps
its own threshold so the central disk does not move; and those rings join the region
after the size filter rather than being asked to be large themselves.

On the shadowed sweep this takes the mask from 16,587 px (0.66 %) to 818,184 px
(32.32 %), against 956,705 px (37.79 %) for the reference implementation, at a
precision of 0.92 against it. Clean sweeps move from 0.60 % to 0.82 %, the width of
the same arm.

One thing this costs: an empty mask used to be a statement about the beam centre,
because the seeds were placed at it. It no longer is, and a centre wrong by a couple
of hundred pixels now draws the rings across the background's own fall-off and
returns a large spurious mask instead of an empty one. The log message says so. The
fix is ordering - the centre is measured from this same projection a moment later -
and is not attempted here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 07:36:57 +02:00
..
2026-09-09 07:25:13 +02:00
2026-09-10 17:26:55 +02:00
2026-09-09 07:25:13 +02:00
2026-09-09 07:25:13 +02:00
2026-09-09 07:25:13 +02:00
2025-04-14 11:52:06 +02:00
2024-11-22 21:25:20 +01:00
2026-02-18 16:17:21 +01:00
2026-08-26 22:47:00 +02:00
2024-11-17 14:55:09 +01:00
2026-08-13 17:03:10 +02:00
2026-09-02 21:17:31 +02:00
2026-08-13 17:03:10 +02:00
2026-09-02 21:17:31 +02:00
2025-11-28 12:47:35 +01:00
2026-06-23 20:29:49 +02:00
2026-07-11 07:19:11 +02:00
2024-12-02 21:17:14 +01:00
2024-12-02 21:17:14 +01:00
2026-08-13 17:03:10 +02:00
2026-09-02 21:17:31 +02:00
2026-08-26 22:47:00 +02:00
2026-08-26 22:47:00 +02:00
2024-11-22 21:25:20 +01:00
2026-09-09 07:25:13 +02:00
2026-09-02 21:17:31 +02:00
2026-09-02 21:17:31 +02:00
2026-09-02 21:17:31 +02:00
2026-09-09 07:25:13 +02:00
2026-09-09 07:25:13 +02:00
2026-09-09 07:25:13 +02:00
2026-09-02 21:17:31 +02:00
2026-08-25 08:21:39 +02:00
2026-08-26 22:47:00 +02:00
2026-09-02 21:17:31 +02:00
2026-09-02 21:17:31 +02:00
2024-11-17 14:55:09 +01:00
2024-11-22 21:25:20 +01:00