Rugnux: fit the beam centre without the transmitting beam-stop pieces

a1816e905 adds the partly transmitting holder-arm pieces to the beam-stop mask, and the
background beam-centre fit read that mask too. A thin arm running into the beam, masked, takes
cells out of the rings it crosses; which radial bins stay above the sector-coverage gate then
changes as the trial centre moves, and a walk seeded beside the arm (the FFT capture sat 48 px off)
limit-cycled on that edge and stopped 44 px short (sigma 0.34 -> 2.27 px). On an open-arm set whose
header centre is 171 px out, the measured centre no longer indexed (60/60 -> 0/60), the run kept the
file's centre and merged P1 at CC1/2 0.004 instead of P212121 at 0.995.

The arm's dimming is multiplicative in azimuth, which the fit's per-sector amplitude already
absorbs, so the fit now uses the mask without those pieces (ShadowFinder marks them TRANSMITTING);
integration still masks them. The fitted centre is back to its a0518abe6 value on every set checked
(the failing one plus four arm sets); the failing set merges P212121, CC1/2 0.995, ISa 22.6.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-09-27 08:34:36 +02:00
1 parent e9da892790
commit a42b73ccfb
4 files changed
+28 -9

No files matched your search

+2 -2
View File
@@ -831,7 +831,7 @@ std::vector<uint32_t> ShadowFinder::GetMask(size_t nthreads) const {
region[i] = 0;
for (int i = 0; i < n_pixels; i++)
mask[i] = region[i] ? 1 : 0;
mask[i] = region[i] ? SHADOW : 0;
// Hardware that lets part of the beam through - a thin holder arm, or one whose shadow is blurred
// by its distance from the detector - sits between PENUMBRA_RATIO and SHADOW_RATIO along most of
@@ -878,7 +878,7 @@ std::vector<uint32_t> ShadowFinder::GetMask(size_t nthreads) const {
if (n_dim >= MIN_SHADOW_PIXELS && n_low >= MIN_CORE_PIXELS)
for (const int i : component)
if (dim[i])
mask[i] = 1;
mask[i] = TRANSMITTING;
}
return mask;
}
+6 -1
View File
@@ -98,6 +98,9 @@ class ShadowFinder {
[[nodiscard]] Projection Reduce() const;
public:
static constexpr uint32_t SHADOW = 1;
static constexpr uint32_t TRANSMITTING = 2;
ShadowFinder(const DiffractionExperiment &experiment, const PixelMask &mask);
// The centre the rings are drawn about. It starts as the file's, which is the only one there
@@ -116,7 +119,9 @@ public:
// decompression, reused across the calls of one worker.
void AddImage(const DataMessage &data, std::vector<uint8_t> &buffer, size_t shard = 0);
// Compute the shadow mask (1 = shadow, 0 = keep), of the converted pixel count.
// Compute the shadow mask (SHADOW, TRANSMITTING or 0 = keep), of the converted pixel count.
// TRANSMITTING marks the pieces of hardware that let part of the beam through, added after the
// shadow proper; both are masked, and a consumer that must not see those pieces can tell them apart.
// Recomputed from the accumulators on each call - meant to be called once at the end.
// nthreads = 0 asks for all hardware threads. The per-pixel passes over a 16M-pixel detector
// dominate this, and they are all exactly parallel.