ess.sans.beam_center_finder.beam_center_from_center_of_mass#

ess.sans.beam_center_finder.beam_center_from_center_of_mass(workflow)[source]#

Estimate the beam center via the center-of-mass of the data counts.

The center-of-mass is simply the weighted mean of the positions. Areas with low counts are excluded from the center of mass calculation, as they typically fall into asymmetric regions of the detector panel and would thus lead to a biased result.

The result is the center-of-mass relative to the sample, i.e., the transverse offset of the beam together with the distance from the sample at which that offset was determined. See ess.sans.types.BeamCenter.

On a bank with depth, the reported distance is the intensity-weighted mean depth, not the geometric center of the bank: layers closer to the sample see more counts and pull it forward. That is consistent rather than wrong. The transverse position of the beam is linear in the distance from the sample, so any intensity-weighted average of points on the beam is again a point on the beam. The weighting moves the result along the beam, not away from it, and the reported distance says where it ended up.

This holds as long as the intensity is symmetric around the beam at every depth. It is not exactly true: masking, the shadow of the beam stop and, with gravity, the wavelength-dependent drop all bias the center-of-mass, and they do so differently at different depths. The resulting uncertainty on the distance is a few centimetres for a Loki bank, which is of the order of the depth of the bank itself. The distance is used to extrapolate the transverse offset to other banks, where an error of a few centimetres out of several metres is negligible, but it means the variation of the correction within one bank is not resolved any better than the noise on it.

The result is anchored at the sample position, so an error in the sample position at the time of determination tilts the inferred beam direction by that error divided by the distance. One millimetre of transverse error at five metres is 0.2 mrad, which is 0.24 mm of transverse error on a bank one metre from the sample. Errors along the beam are second order and negligible. Note that this is an error on the beam direction and does not require the sample to be in the same place for the run the beam center is applied to: the direction is re-anchored at that run’s own sample position.

Parameters:

workflow (Pipeline) – The reduction workflow to compute CorrectedDetector[SampleRun, Numerator].

Returns:

types.BeamCenter (scipp.Variable) – The beam center position as a vector.