hyperspy._components.gaussian module¶
-
class
hyperspy._components.gaussian.Gaussian(A=1.0, sigma=1.0, centre=0.0, module='numexpr', **kwargs)¶ Bases:
hyperspy._components.expression.ExpressionNormalized Gaussian function component.
![f(x) = \frac{A}{\sigma \sqrt{2\pi}}\exp\left[
-\frac{\left(x-x_0\right)^{2}}{2\sigma^{2}}\right]](../_images/math/4a14a237e6c5078e43f0bc16192b6e8cbfd0f058.png)
Variable
Parameter

A

sigma

centre
- Parameters
A (float) – Height scaled by
. GaussianHFimplements the Gaussian function with a height parameter corresponding to the peak height.sigma (float) – Scale parameter of the Gaussian distribution.
centre (float) – Location of the Gaussian maximum (peak position).
**kwargs – Extra keyword arguments are passed to the
Expressioncomponent.
For convenience the fwhm attribute can be used to get and set the full-with-half-maximum.
-
estimate_parameters(signal, x1, x2, only_current=False)¶ Estimate the Gaussian by calculating the momenta.
- Parameters
- Returns
- Return type
Notes
Adapted from http://www.scipy.org/Cookbook/FittingData
Examples
>>> g = hs.model.components1D.Gaussian() >>> x = np.arange(-10, 10, 0.01) >>> data = np.zeros((32, 32, 2000)) >>> data[:] = g.function(x).reshape((1, 1, 2000)) >>> s = hs.signals.Signal1D(data) >>> s.axes_manager._axes[-1].offset = -10 >>> s.axes_manager._axes[-1].scale = 0.01 >>> g.estimate_parameters(s, -10, 10, False)
-
property
fwhm¶