dials.tof_integrate · neutron time-of-flight Laue

Keeping overlapped reflections:
a joint 3D fit of neighbouring peaks

How overlaps.mode=deconvolve splits shared counts between reflections whose integration boxes overlap.

DIALS branch tof-overlap-handling · November 2026
← → or click to move · p pause animations · t light/dark · f full screen

The problem

Wide peaks need big boxes, and big boxes overlap

On MANDI a peak has σ ≈ 2.9 × 2.1 px on the detector, so a box that holds it is 15 px or more across.

  • The default overlaps.mode=reject throws away every reflection whose box touches another.
  • Even modest padding around each peak makes a large share of boxes touch, and completeness drops.
  • The large-cell crystals, which need neutrons most, lose the most.

Illustration: random spots with MANDI peak widths. Overlap is judged here on the detector face only; the code also requires the boxes to overlap in ToF.

Overview

Six steps per experiment

mask stops after step 4; deconvolve goes on to fit the clusters jointly.

1

Own the shared voxels

Each voxel in two boxes goes to one reflection. The other copy is flagged Overlapped. This runs before any mask, so a strong neighbour can't capture a weak reflection's foreground.

2

Find foregrounds

The ellipse mask is seeded and weighted ignoring Overlapped voxels. Labelling is still geometric, so a real overlap still shows.

3

Mask neighbour foregrounds

A voxel in one reflection's foreground is excluded from every other box. Overlapping reflections are flagged overlapped_fg if their own foreground reaches a neighbour, else overlapped_bg.

4

Integrate on clean voxels

overlapped_bg reflections are integrated as usual ("recovered"). The profile library is built here, from strong clean reflections.

5

Group into clusters

Reflections whose foregrounds reach each other are coupled. Clusters are the connected components. With estimator=joint, everything else is a cluster of one.

6

Fit each cluster jointly

One weighted linear solve per cluster for all member intensities, with shapes and positions from the library. Threaded.

Steps 1–3 · ownership and masks

Who owns a shared voxel

The nearest predicted centroid wins, with each axis scaled by that reflection's box half-width h:

Dk2=∑a∈{x,y,t}(va−ck,ahk,a)2

Without the scaling ToF would decide every case: a box is far deeper in frames than it is wide in pixels.

Shaded: box A ■ / box B ■; strong shading marks shared voxels. Dots: foreground. ✕: a foreground voxel owned by the neighbour.

Step 6 · the model

With shapes and positions known, the data are linear in the intensities

di=∑k=1KakPik+εivoxel i, reflection k, unit-intensity profile Pik

One ToF line through two peaks. Nothing in P is fitted: only the amplitudes ak.

Far apart, each amplitude is measured independently. As the peaks close in, the fit still splits the counts, but the two estimates become anticorrelated and their errors grow.

Simulated counts, iBIX ToF shape, flat background, 4 reweighting passes.

Step 6 · the profile

Each profile is a ToF line shape times a detector-face Gaussian

show: drag to rotate
Pik=Tk(ti)Gk(xi,yi)Zk,∑i∈boxkPik=1
  • T: iBIX back-to-back exponential ⊗ Gaussian in ToF (α, β, σ).
  • G: bivariate Gaussian on the face (σx, σy, ρ).
  • Normalised over the box, so ak is the intensity inside the box: what summation measures.
  • Each voxel enters the fit once, from its owner's shoebox, with the owner's background.
Where shapes and positions come from

The profile library, and why the profile is broadened

Strong clean reflections give, per panel: the ToF shape, the face covariance, the median offset of observed from predicted position, and the scatter s of that offset.

A peak is placed at its prediction plus the median offset. Its true position is off by an unknown δ. A sharp profile in the wrong place always loses intensity. Averaged over δ, the expected peak is the shape convolved with the scatter:

σ′2=σ2+s2in x,y, ToF E[a^/a]=2σp2σp2+σ2+s2

σp = width of the fitted profile. It equals 1 when σp² = σ² + s².

The solve

Weighted least squares, and what closeness does to it

separation d / σ
χ2=∑i(di−∑kakPik)2Vi a^=(PTWP)−1PTWd C=(PTWP)−1,Wii=1/Vi

The K × K system is inverted by eigendecomposition. For two equal Gaussians a distance d apart:

corr(a^1,a^2)=−e−d2/4σ2

At d → 0 only a₁ + a₂ is measured. A cluster whose smallest eigenvalue is below 10⁻¹² of the largest is left unfitted.

The weights

Weight by the counts the model expects, not the counts observed

Most voxels hold 0 or 1 count. Weighting by the observed counts gives the voxels that saw a count less weight than the empty ones, and the estimate reads low.

Instead, each voxel's variance comes from the current model, and the solve is repeated (first pass flat, then 4 passes):

Vi=gi2(Bi+max(mi,0)gi)+Vispec mi=∑ka^kPik

At convergence this is the Poisson maximum-likelihood solution.

gi: corrected value of one count (bin width, Lorentz, incident spectrum). Bi: background in counts.

Error model

Three parts of the covariance

1 · Counting. C from the solve. The voxel variance from the corrector already holds the background, B(1 + nsig/nbg); that part is taken out so it is not counted twice.

2 · Model misfit. Reduced χ² over the peak voxels (profile ≥ 5% of its maximum):

χν2=1npeak−K∑i∈peak(di−mi)2Vi,C←max(1,χν2)C

3 · Background level. One common shift of every voxel an owner o supplies, propagated through the fit:

C+=∑oB¯onbg,o(C0uo)(C0uo)T,(uo)k=∑i∈owigiPik

The background level is estimated, not known. Its error moves every voxel of a shoebox together, so it moves the fitted intensities together: one correlated term, not independent noise in each voxel.

A choice that matters

Normalise over the box, not the whole peak

With P normalised over the box, a is the intensity inside the box, as summation measures it.

Normalising over the whole peak instead extrapolates past the box edge: the estimate becomes a/f, with f the fraction of the model inside. Every error in the model's tails is multiplied by 1/f.

Tried and reverted: reflections with small f blow up, and cut-offs on f still merge worse than box normalisation. f is kept as overlap.fit.fraction.

overlaps.estimator=joint

One estimator for every reflection

  • separate: only overlapped_fg reflections take the 3D fit; the rest keep the 1D profilelib fit, rescaled by one median 3D/1D ratio.
  • One ratio can't reconcile the two: the 1D fit never goes negative and reads weak reflections high. The 3D fit tracks summation at every strength.
  • joint: every reflection is fitted with the 3D model, coupled ones in their clusters, the rest alone. The 1D fit is kept as intensity.prf_1d.
  • A reflection the 3D model can't fit loses its profile intensity rather than fall back to 1D, so the estimators never mix.

Schematic: a weak reflection (true I = 0.5σ) measured many times by an unbiased estimator and by one that cannot return a negative value.

Limits and next steps

What the model does not do yet

  • Positions are fixed at prediction + panel median offset. Unbiased on average, but not for one close pair. Next: refine each peak's centre within its cluster, restrained by the library's position scatter.
  • Some data sets need a large proportional error term in scaling. Hypothesis: the share of a peak inside its box varies with box size between equivalents. Next: normalise over a fixed window per panel.
  • Background is fitted before the peaks, not with them.
  • Plumbing: dials.export intensity=profile+sum drops deconvolved reflections; xia2 does not expose the options yet.
To use it

method=profile_1d_profilelib
overlaps.mode=deconvolve
overlaps.estimator=joint
bbox_xy_padding=6
plus dials.generate_mask border=N for dead panel edges

← → navigate · p pause · t theme · f full screen
paused