ess.reflectometry.tools.smooth_with_resolution#

ess.reflectometry.tools.smooth_with_resolution(ideal, measured, *, plateau_fraction=0.6)[source]#

Smooth an ideal reflectivity curve using the measured Q resolution.

Uses a symmetric trapezoid with a Q-dependent width, scaled so that its standard deviation matches Q_resolution. The kernel shape is a modelling assumption: the standard deviation alone does not determine the response. Requires the optional Refl1D package (pip install refl1d).

Parameters:
  • ideal (DataArray) – One-dimensional reflectivity with point coordinates Q. Refl1D linearly interpolates between these samples; the grid should be fine compared with the resolution width.

  • measured (DataArray) – One-dimensional reduced reflectivity with Q and Q_resolution coordinates. Q may contain points or bin edges; Q_resolution contains the standard deviation at each point or bin.

  • plateau_fraction (float, default: 0.6) – Fraction of the kernel’s full support occupied by the plateau, in the interval [0, 1). Zero gives a triangular kernel.

Returns:

DataArray – Smoothed reflectivity at the measured Q points or bin centres, with the unit of ideal. Invalid resolutions and points whose kernel extends beyond the ideal curve are NaN. Zero resolution gives linear interpolation without smoothing. The final bin width is not included in the resolution; measured bins should be fine compared with it.