neutronpy.functions.voigt

neutronpy.functions.voigt(p, q)[source]

Returns an arbitrary number of Voigt profiles, a Lorentz profile convoluted by a Gaussian.

Parameters:
p : ndarray

Parameters for the Lorentzian, in the following format:

p[0] Constant background
p[1] Linear background slope
p[2] Area under the first peak
p[3] Position of the first peak
p[4] FWHM of the first Lorentzian
p[5] FWHM of the first Gaussian
p[6] Area under the second peak
p[…] etc.
q : ndarray

One dimensional input array.

Returns:
out : ndarray

One dimensional Voigt profile.

Notes

A Voigt profile is defined as a convolution of a Lorentzian profile with a Gaussian Profile:

\[V(x;\sigma,\gamma)=\int_{-\infty}^\infty G(x';\sigma)L(x-x';\gamma)\, dx'.\]

Examples

Plot a single Voigt profile with an integrated intensity of 1, centered at zero, and FWHM = 0.2 convoluted with a Gaussian with FWHM = 0.3:

>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> p = np.array([0., 0., 1., 0., 0.2, 0.3])
>>> x = np.linspace(-1, 1, 101)
>>> y = voigt(p, x)
>>> plt.plot(x, y)
>>> plt.show()

Plot two Voigt profiles, equidistant from the origin with the same intensity and fwhm as above:

>>> p = np.array([0., 0., 1., -0.3, 0.2, 0.3, 1., 0.3, 0.2, 0.3])
>>> x = np.linspace(-1, 1, 101)
>>> y = voigt(p, x)
>>> plt.plot(x, y)
>>> plt.show()