hyperspy._components.split_voigt module

class hyperspy._components.split_voigt.SplitVoigt(A=1.0, sigma1=1.0, sigma2=1.0, fraction=0.0, centre=0.0)

Bases: hyperspy.component.Component

Split pseudo-Voigt

\[
pV(x,centre,\sigma) = (1 - \eta) G(x,centre,\sigma)
+ \eta L(x,centre,\sigma)
\]


\[
f(x) =
\begin{cases}
    pV(x,centre,\sigma_1), & x \leq centre\\
    pV(x,centre,\sigma_2), & x >  centre
\end{cases}
\]

Variable

Parameter

A

A

\eta

fraction

\sigma_1

sigma1

\sigma_2

sigma2

centre

centre

Note

This is a voigt function in which the upstream and downstream variance or sigma is allowed to vary to create an asymmetric profile In this case the voigt is a pseudo voigt- consisting of a mixed gaussian and lorentzian sum

estimate_parameters(signal, x1, x2, only_current=False)
Estimate the split voigt function by calculating the

momenta the gaussian.

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.

Returns

Return type

bool

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' : data})
>>> s.axes_manager.axes[-1].offset = -10
>>> s.axes_manager.axes[-1].scale = 0.01
>>> g.estimate_parameters(s, -10,10, False)
function(x)

Split pseudo voigt - a linear combination of gaussian and lorentzian

Parameters
  • x (array) – independent variable

  • A (float) – area of pvoigt peak

  • center (float) – center position

  • sigma1 (float) – standard deviation <= center position

  • sigma2 (float) – standard deviation > center position

  • fraction (float) – weight for lorentzian peak in the linear combination, and (1-fraction) is the weight for gaussian peak.

function_nd(axis)

Returns a numpy array containing the value of the component for all indices. If enough memory is available, this is useful to quickly to obtain the fitted component without iterating over the navigation axes.