exspy.components#

DoublePowerLaw([A, r, origin, shift, ratio, ...])

Double power law component for EELS spectra.

EELSArctan([A, k, x0, module])

Arctan function component for EELS (with minimum at zero).

EELSCLEdge(element_subshell[, GOS, ...])

param parameter_name_list:

The list of parameter names.

PESCoreLineShape([A, FWHM, origin, ab, shirley])

param parameter_name_list:

The list of parameter names.

PESVoigt()

Voigt component for photoemission spectroscopy data analysis.

SEE([A, Phi, B, module, compute_gradients])

Secondary electron emission component for Photoemission Spectroscopy.

Vignetting()

Model the vignetting of the lens with a cos^4 law multiplied by lines on the edges

VolumePlasmonDrude([intensity, ...])

Drude volume plasmon energy loss function component, the energy loss function is defined as:

Components

class exspy.components.DoublePowerLaw(A=1e-05, r=3.0, origin=0.0, shift=20.0, ratio=1.0, left_cutoff=0.0, module='numexpr', compute_gradients=False, **kwargs)#

Bases: Expression

Double power law component for EELS spectra.

\[f(x) = A \cdot [s_r \cdot (x - x_0 - x_s)^{-r} + (x - x_0)^{-r}]\]

Variable

Parameter

\(A\)

A

\(r\)

r

\(x_0\)

origin

\(x_s\)

shift

\(s_r\)

ratio

Parameters:
  • A (float) – Height parameter.

  • r (float) – Power law coefficient.

  • origin (float) – Location parameter.

  • shift (float) – Offset of second power law.

  • ratio (float) – Height ratio of the two power law components.

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

left_cutoff#

For x <= left_cutoff, the function returns 0. Default value is 0.0.

Type:

float

Parameters:
  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

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.

class exspy.components.EELSArctan(A=1.0, k=1.0, x0=1.0, module=['numpy', 'scipy'], **kwargs)#

Bases: Expression

Arctan function component for EELS (with minimum at zero).

\[f(x) = A \cdot \left( \frac{\pi}{2} + \arctan \left[ k \left( x-x_0 \right) \right] \right)\]

Variable

Parameter

\(A\)

A

\(k\)

k

\(x_0\)

x0

Parameters:
  • A (float) – Amplitude parameter. \(\lim_{x\to -\infty}f(x)=0\) and \(\lim_{x\to\infty}f(x)=2A\)

  • k (float) – Slope (steepness of the step). The larger \(k\), the sharper the step.

  • x0 (float) – Center parameter (\(f(x_0)=A\)).

  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

class exspy.components.EELSCLEdge(element_subshell, GOS='gosh', gos_file_path=None)#

Bases: Component

Parameters:
  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

as_dictionary(fullcopy=True)#

Returns component as a dictionary. For more information on method and conventions, see export_to_dictionary().

Parameters:

fullcopy (bool, optional False) – Copies of objects are stored, not references. If any found, functions will be pickled and signals converted to dictionaries

Returns:

dic – A dictionary, containing at least the following fields:

  • parameters: a list of dictionaries of the parameters, one per component.

  • _whitelist: a dictionary with keys used as references saved attributes, for more information, see export_to_dictionary().

  • any field from _whitelist.keys().

Return type:

dict

property fine_structure_smoothing#

Controls the level of the smoothing of the fine structure.

It must a real number between 0 and 1. The higher close to 0 the higher the smoothing.

fix_fine_structure()#

Fixes the fine structure spline and the parameters of the fine structure components, if any.

free_fine_structure()#

Frees the parameters of the fine structure

If there are fine structure components, only the parameters that have been previously fixed with fix_fine_structure will be set free.

The spline parameters set free only if fine_structure_spline_active is True.

function(E)#

Returns the number of counts in barns

get_fine_structure_as_signal1D()#

Returns a spectrum containing the fine structure.

Notes

The fine structure is corrected from multiple scattering if the model was convolved with a low-loss spectrum

gui(display=True, toolkit=None, **kwargs)#

Display or return interactive GUI element if available.

Parameters:
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of str or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

set_microscope_parameters(E0, alpha, beta, energy_scale)#

Set the microscope parameters.

Parameters:
  • E0 (float) – Electron beam energy in keV.

  • alpha (float) – Convergence semi-angle in mrad.

  • beta (float) – Collection semi-angle in mrad.

  • energy_scale (float) – The energy step in eV.

class exspy.components.PESVoigt#

Bases: Component

Voigt component for photoemission spectroscopy data analysis.

Voigt profile component with support for shirley background, non_isochromaticity, transmission_function corrections and spin orbit splitting specially suited for photoemission spectroscopy data analysis.

\[f(x) = G(x) \cdot L(x)\]

where \(G(x)\) is the Gaussian function and \(L(x)\) is the Lorentzian function. This component uses an approximate formula by David (see Notes).

Parameters:
  • area (Parameter) – Intensity below the peak.

  • centre (Parameter) – Location of the maximum of the peak.

  • FWHM (Parameter) – FWHM = \(2 \sigma \sqrt{(2 \log(2))}\) of the Gaussian distribution.

  • gamma (Parameter) – \(\gamma\) of the Lorentzian distribution.

  • resolution (Parameter) –

  • shirley_background (Parameter) –

  • non_isochromaticity (Parameter) –

  • transmission_function (Parameter) –

  • spin_orbit_splitting (Bool) –

  • spin_orbit_branching_ratio (float) –

  • spin_orbit_splitting_energy (float) –

Notes

Uses an approximate formula according to W.I.F. David, J. Appl. Cryst. (1986). 19, 63-64. doi:10.1107/S0021889886089999

Parameters:
  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

estimate_parameters(signal, E1, E2, only_current=False)#

Estimate the Voigt function by calculating the momenta of 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:

Exit status required for the remove_background() function.

Return type:

bool

Notes

Adapted from https://scipy-cookbook.readthedocs.io/items/FittingData.html

Examples

>>> g = hs.model.components1D.PESVoigt()
>>> 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[-1].offset = -10
>>> s.axes_manager[-1].scale = 0.01
>>> g.estimate_parameters(s, -10, 10, False)
class exspy.components.SEE(A=1.0, Phi=1.0, B=0.0, module='numexpr', compute_gradients=False, **kwargs)#

Bases: Expression

Secondary electron emission component for Photoemission Spectroscopy.

\[ f(x) = \begin{cases} 0, & x \leq \Phi\\ A\cdot{ (x-\Phi) / (x-\Phi+B)^{4}}, & x > \Phi \end{cases} \]

Variable

Parameter

\(A\)

A

\(\Phi\)

Phi

\(B\)

B

Parameters:
  • A (float) – Height parameter

  • Phi (float) – Position parameter

  • B (float) – Tail or asymmetry parameter

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

  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

class exspy.components.Vignetting#

Bases: Component

Model the vignetting of the lens with a cos^4 law multiplied by lines on the edges

Parameters:
  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.

class exspy.components.VolumePlasmonDrude(intensity=1.0, plasmon_energy=15.0, fwhm=1.5, module='numexpr', compute_gradients=False, **kwargs)#

Bases: Expression

Drude volume plasmon energy loss function component, the energy loss function is defined as:

\[f(E) = I_0 \frac{E(\Delta E_p)E_p^2}{(E^2-E_p^2)^2+(E\Delta E_p)^2}\]

Variable

Parameter

\(I_0\)

intensity

\(E_p\)

plasmon_energy

\(\Delta E_p\)

fwhm

Parameters:

Notes

Refer to Egerton, R. F., Electron Energy-Loss Spectroscopy in the Electron Microscope, 2nd edition, Plenum Press 1996, pp. 154-158 for details, including original equations.

Parameters:
  • parameter_name_list (list) – The list of parameter names.

  • linear_parameter_list (list, optional) – The list of linear parameter. The default is None.