hyperspy._components.polynomial module

class hyperspy._components.polynomial.Polynomial(order=2, module='numexpr', **kwargs)

Bases: Expression

n-order polynomial component.

Polynomial component consisting of order + 1 parameters. The parameters are named “a” followed by the corresponding order, i.e.

f(x) = a_{2} x^{2} + a_{1} x^{1} + a_{0}

Zero padding is used for polynomial of order > 10.

Parameters
  • order (int) – Order of the polynomial, must be different from 0.

  • **kwargs – Keyword arguments can be used to initialise the value of the parameters, i.e. a2=2, a1=3, a0=1. Extra keyword arguments are passed to the Expression component.

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

Estimate the parameters by the two area method

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

hyperspy._components.polynomial.convert_to_polynomial(poly_dict)

Convert the dictionary from the old to the new polynomial definition