DoubleGaussianModel

DoubleGaussianModel#

Module: exa.core.model_selection_fitter.models.double_gaussian_model

class DoubleGaussianModel(independent_vars=None, **kwargs)#

Bases: BaseModel

Parameters:
  • independent_vars (list of str, optional) – Arguments to the model function that are independent variables default is [‘x’]).

  • prefix (str, optional) – String to prepend to parameter names, needed to add two Models that have parameter names in common.

  • nan_policy ({'raise', 'propagate', 'omit'}, optional) – How to handle NaN and missing values in data. See Notes below.

  • **kwargs (optional) – Keyword arguments to pass to Model.

Notes

1. nan_policy sets what to do when a NaN or missing value is seen in the data. Should be one of:

  • ‘raise’ : raise a ValueError (default)

  • ‘propagate’ : do nothing

  • ‘omit’ : drop missing data

Initializes the DoubleGaussianModel.

Parameters:
  • args – Passed to parent __init__.

  • independent_vars (list[Literal['x']] | None) – List of independent variable names.

  • kwargs – Passed to parent __init__.

Attributes

Methods

guess

Estimate initial model parameter values from data.

guess(data, x, **kws)#

Estimate initial model parameter values from data.

Uses scipy.find_peaks to locate most prominent peaks. If data contains at least two peaks, sets their x-coordinates and amplitudes as centers and amplitudes of the Gaussians. The width of the Gaussians is estimated as half a distance between the peaks. If data contains a single peak, sets center of both Gaussians to the x-coordinate of the peak, their amplitude to the peak amplitude, and width to one tenth of the x-range. The value of the offset is set to the minimum value in the data.

Parameters:
  • data (ndarray) – Array of data used to guess parameter values.

  • x (ndarray) – Array of values for the independent variable.

  • kws – Values for the model parameters.

Returns:

Estimated parameters for fitting.

Return type:

Parameters

Inheritance

Inheritance diagram of exa.core.model_selection_fitter.models.double_gaussian_model.DoubleGaussianModel