background_gain::Estimate is the gain of any input that reports detector units: the photon peaks where
the histogram of a few frames shows them (PhotonPeak), else the background's variance per unit mean
(Gain). The stills reader path (MeasureGain) and the pre-scan's CCD measurement now both call it, so a
rotation sweep and a still read the same number from the same frames.
On a CCD the photon-peak test now also sees the pixels outside the active area, all at zero: on one
Saturn sweep that spike, the background hump far above it and the hump's echo at twice the value passed
as photon peaks (gain 2725). A zero-photon peak is the detector's noise and has a width, so a single bin
with nothing beside it is refused. Checked on the 39 SMV/marCCD sets of the battery: every pre-scan
gain is the same as rc178's (no photon peaks; the variance per unit mean as before).
Where the gain is applied stays as it is: a stills file is converted to photons as it is read (the
spot finder and the stills measurements of spot width, bandwidth and partiality work in photons), a
rotation CCD sweep keeps its raw counts and the gain enters the integrator (pixel_gain, 46da7fb35).
Moving the stills to the integrator route too was tried (stills PixelGain, no reader conversion) and
lost badly on MPCCD: R-free +0.032 and +0.047 on two SACLA sets, R_split 0.055 -> 0.091 and 0.067 ->
0.144, with the indexing unchanged; the stills rocking width/bandwidth fit, measured on frames in ADU,
collapsed (bandwidth 0.0015 -> 0.0000).
still_manifest.json: euxfel152 drops --gain 62; the gain is now read off its photon peaks (62.65, on a
baseline of 124.2 left in the frames): R-free 0.252, the same as with --gain 62.649 or 61.5 given by
hand (0.252, 0.252); --gain 62 gives 0.2495 - the R-free moves by ~0.003 with the gain. 66.4% indexed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu