The shadow is a ratio and does not depend on the units, but two tests in the shadow finder are made
in counts: the Poisson significance of a pixel's deficit against its ring, and the maximum a pixel
must reach (25) to have recorded a reflection that is never masked. On a frame analysed in ADU at a
gain g > 1 the first was overstated by sqrt(g) and the second fired on a few photons - on a stop
that lets a little through, the whole stop was given back as "reflections". Both are now taken in
photons: the counts behind the deficit divided by the gain, the reflection count multiplied by it.
CPU and CUDA alike (ShadowMaskSetup carries the gain). g = 1 (every photon-counting input) is
bit-identical by construction.
Tests: ShadowFinder_ADetectorReadInADUGivesThePhotonMask (the photon scene times 9 at gain 9 gives
the photon mask; at gain 1 the stop is given back), and a device-vs-host section on the same scene.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit 148177e3e54c9ac3a129c6ff3cd4fa24e6d34b07)