Integration: the radial background correction carries the corrected background into var_bkg (D14)

The correction moved bkg and I but left the non-signal variance carried to the merge at the ring's
level. var_bkg = g (n bkg + n^2 bkg_var): its first term is the Poisson share of the background under
the signal disk, which is the corrected background, so it now moves with it (CPU, CUDA; Metal runs
the CPU correction). The second term - the noise of the ring estimate - and sigma, which is taken
from the counts in the disk, do not depend on the curve and are unchanged. Not touched: the strong
flag and the centroid are still taken at the uncorrected pedestal.

Only reflections the correction is applied to change; tests: the corrected empty aperture's var_bkg
moves by n_inner times the background change (CPU), and GPU var_bkg matches the CPU with a curve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit 6d85d594a4199e86d67c779b5301e88e48a3ad49)
This commit is contained in:
leonarski_f committed 2026-10-23 21:21:46 +02:00
1 parent e866262ed6
commit 6940718cf5
4 files changed
+17 -6

No files matched your search

@@ -630,6 +630,11 @@ std::vector<Reflection> BraggIntegrationEngineCPU::ProfilePasses(const Sampler &
}
rh.bkg -= corr; // annulus mean -> mean over the signal disk
rh.I = static_cast<double>(rh.I_sum) - static_cast<double>(rh.n_inner) * rh.bkg;
// The background under the disk is now the corrected one, and so is its Poisson share of
// the non-signal variance. The estimate's own variance (bkg_var) stays: it is the noise of
// the ring pixels, which the correction - a smooth curve - does not change; nor does sigma,
// which is taken from the counts in the disk.
rh.var_bkg -= pixel_gain * static_cast<double>(rh.n_inner) * corr;
}
}