# hyperspy._components.skew_normal module

class hyperspy._components.skew_normal.SkewNormal(x0=0.0, A=1.0, scale=1.0, shape=0.0, module=['numpy', 'scipy'], **kwargs)

Bases: Expression

Skew normal distribution component.

Asymmetric peak shape based on a normal distribution.

$\begin{split}f(x) &= 2 A \phi(x) \Phi(x) \\ \phi(x) &= \frac{1}{\sqrt{2\pi}}\mathrm{exp}{\left[ -\frac{t(x)^2}{2}\right]} \\ \Phi(x) &= \frac{1}{2}\left[1 + \mathrm{erf}\left(\frac{ \alpha~t(x)}{\sqrt{2}}\right)\right] \\ t(x) &= \frac{x-x_0}{\omega}\end{split}$

Variable

Parameter

$$x_0$$

x0

$$A$$

A

$$\omega$$

scale

$$\alpha$$

shape

Parameters:
• x0 (float) – Location of the peak position (not maximum, which is given by the mode property).

• A (float) – Height parameter of the peak.

• scale (float) – Width (sigma) parameter.

• shape (float) – Skewness (asymmetry) parameter. For shape=0, the normal distribution (Gaussian) is obtained. The distribution is right skewed (longer tail to the right) if shape>0 and is left skewed if shape<0.

• **kwargs – Extra keyword arguments are passed to the Expression component.

Notes

The properties mean (position), variance, skewness and mode (position of maximum) are defined for convenience.

estimate_parameters(signal, x1, x2, only_current=False)

Estimate the skew normal distribution by calculating the momenta.

Parameters:
• signal (Signal1D instance) –

• x1 (float) – Defines the left limit of the spectral range to use for the estimation.

• x2 (float) – Defines the right limit of the spectral range to use for the estimation.

• only_current (bool) – If False estimates the parameters for the full dataset.

Return type:

bool

Notes

Adapted from Lin, Lee and Yen, Statistica Sinica 17, 909-927 (2007) https://www.jstor.org/stable/24307705

Examples

>>> g = hs.model.components1D.SkewNormal()
>>> 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 mean

Mean (position) of the component.

property mode

Mode (position of maximum) of the component.

property skewness

Skewness of the component.

property variance

Variance of the component.