ewoksxas.fit.silx_engine#

silx fitting engine helpers shared by the peak-fit backend and the widget.

This module wraps silx.math.fit (the engine behind silx.gui.fit.FitWidget) so the headless ewoks task and the interactive Orange widget configure the same fit:

  • make_fit_manager() builds a FitManager carrying only the peak theories we expose (so every selectable shape yields a meaningful descriptor) and, optionally, only the supported backgrounds.

  • descriptors_from_fit_results() turns silx’s raw fit_results into the physically meaningful per-peak descriptors (center, height, area, FWHM and the pseudo-Voigt mixing) the task and widget report.

  • background_curve() evaluates the fitted background over the manager’s x-grid, splitting the total model into background and peak contributions.

  • strip_theory()/snip_theory() are drop-in replacements for silx’s stock Strip/Snip peak-stripping backgrounds, whose process-wide caches crash when the data length changes between fits (a region-of-interest change) and tear under concurrent fits; make_fit_manager() installs them on every manager.

silx peak theories report Height (the true peak maximum) directly; the integrated area is derived from the height and width(s) with the closed-form expressions in area_from_height() – numerically integrating the model curve would truncate the heavy Lorentzian/Voigt tails.

Functions

area_from_height(family, height, *[, fwhm, ...])

Return the analytic integrated area of a peak from its height and width.

background_curve(manager)

Evaluate the fitted background of a manager over its x-grid.

descriptors_from_fit_results(fit_results, ...)

Return the per-peak descriptors from silx fit_results.

make_fit_manager([curated_backgrounds])

Return a FitManager carrying the curated peak theories.

snip_theory()

Return a fresh Snip background theory with a per-manager cache.

strip_theory()

Return a fresh Strip background theory with a per-manager cache.