Skip to content

Experimental-data fitting: resolution smearing, background term, log/robust residuals #16

Description

@mlund

Improvements to matching computed profiles against real data. Both are cheap (no scattering-kernel changes) and pair naturally.

1. Instrumental resolution smearing of I(q)
Optionally smear the computed profile by a resolution function before output/comparison: convolve I(q) with a Gaussian of q-dependent width, or accept a per-point Δq column alongside the experimental data. Post-processing on the output array only.

2. Fitting objective extensions (cached model makes each evaluation sub-ms, so cost is only in the cost function)

  • Fitted flat background b: I_fit = scale*I_model + b. Standard nuisance parameter for residual constant scattering; distinct from upstream buffer subtraction (still out of scope).
  • Log-space residual option (log I_exp - log I_fit) so low-q does not dominate χ² over data spanning decades.
  • Optional robust loss (e.g. Huber) for outlier tolerance.

Behind the existing Nelder-Mead / scipy fit API.

Future SANS benefit: all of these matter more for SANS than SAXS — resolution smearing is essential (wavelength spread + collimation give broad, q-dependent Δq), and SANS data carry a flat incoherent background with larger relative errors, where a fitted background term plus log/robust residuals help. Adding them now makes the eventual SANS path usable rather than an afterthought.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions