scippneutron.peaks.model.LorentzianModel#

class scippneutron.peaks.model.LorentzianModel(*, prefix='')[source]#

A Lorentzian function with arbitrary normalization.

The model implements

\[f(x; A, \mu, \sigma) = \frac{A}{\pi} \frac{\sigma}{{(x-\mu)}^2 + \sigma^2}\]

with parameters

  • \(A\): 'amplitude'

  • \(\mu\): 'loc'

  • \(\sigma\): 'scale'

__init__(*, prefix='')[source]#

Initialize a Lorentzian model.

Parameters:

prefix (str, default: '') – Prefix for model parameter names.

Methods

__init__(*[, prefix])

Initialize a Lorentzian model.

fwhm(params)

Compute full width at half maximum.

guess(data, *[, coord])

Roughly estimate the model parameters for given data.

with_prefix(prefix)

Return a copy of the model with a new prefix.

Attributes

param_bounds

Parameter bounds.

param_names

Parameter names including the prefix.

prefix

Prefix for parameter names.

fwhm(params)[source]#

Compute full width at half maximum.

Parameters:

params (dict[str, Variable]) – Parameter values for which to compute the FWHM.

Returns:

Variable – FWHM of the model at the given parameters.