Builtins

This module provides several built-in models for incoherent neutron scattering data fitting.

These functions generate a Model class instance from the lmfit package [1].

References

[1]https://lmfit.github.io/lmfit-py/
class lmfit_builtins.ModelDeltaLorentzians(q, nLor=2, **kwargs)

A Dirac delta with a given number of Lorentzians.

Parameters:
  • q (np.array or list) – Array of momentum transfer q-values to be used.
  • nLor (int, optional) – Number of Lorentzians to be included in the model.
  • kwargs (dict) – Additional keyword arguments to pass to build_2D_model()
class lmfit_builtins.ModelGaussBkgd(q, **kwargs)

A Gaussian with a background term.

Can be useful for empty can signal.

Parameters:
  • q (np.array or list) – Array of momentum transfer q-values to be used.
  • kwargs (dict) – Additional keyword arguments to pass to build_2D_model()
class lmfit_builtins.ModelPVoigtBkgd(q, **kwargs)

A pseudo-voigt profile with a background term.

Parameters:
  • q (np.array or list) – Array of momentum transfer q-values to be used.
  • kwargs (dict) – Additional keyword arguments to pass to build_2D_model()
lmfit_builtins.guess_from_qens(pars, pGlobals, data, x, q, prefix=None)

Estimate starting values from 2D peak data and create Parameters.

Notes

The dataset should be of shape (number of q-values, energies), that is, the function should be called for each value of ‘observable’.

lmfit_builtins.update_param_vals(pars, prefix, **kwargs)

Update parameter values with keyword arguments.