scippneutron.peaks.model.PseudoVoigtModel#

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

A Pseudo-Voigt function.

The model implements

\[f(x; A, \mu, \sigma, \alpha) = \alpha L(x; A, \mu, \sigma) + (1-\alpha) G(x; A, \mu, \sigma_G)\]

where \(L\) is a Lorentzian and \(G\) is a Gaussian. \(\sigma_G\) is derived from \(\sigma\) such that \(L\) and \(G\) have the same FWHM.

It has parameters

  • \(A\): 'amplitude'

  • \(\mu\): 'loc'

  • \(\sigma\): 'scale'

  • \(\alpha\): 'fraction'

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

Initialize a base model.

Parameters:
  • param_names – Names of parameters in arbitrary order. Does not include the prefix.

  • prefix (str, default: '') – Prefix used for model parameters in all user-facing data.

Methods

__init__(*[, prefix])

Initialize a base 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.