scippneutron.peaks.model.CompositeModel#

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

A combination of two models.

Composite models contain a “left” and a “right” submodel which are combined into

\[f(x) = \text{left}(x) + \text{right}(x)\]

Composite models can be constructed by adding models, e.g.,

left = PolynomialModel(degree=2)
right = GaussianModel()
composite = left + right

The parameters of the composite are the union of the component parameters. If there is a clash between the names of component models, they must be disambiguated by using prefixes.

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

Initialize a composite model.

Parameters:
  • left (Model) – Left component model.

  • right (Model) – Right component model.

  • prefix (str, default: '') – Prefix for all model parameter names. It is prepended to the prefixes of the component models.

Methods

__init__(left, right, *[, prefix])

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