skued.lorentzian
- skued.lorentzian(coordinates, center, fwhm)
Unit integral Lorenzian function.
- Parameters:
coordinates (array-like) – Can be either a list of ndarrays, as a meshgrid coordinates list, or a single ndarray for 1D computation
center (array-like) – Center of the lorentzian. Should be the same shape as coordinates.ndim.
fwhm (float) – Full-width at half-max of the function.
- Returns:
out – Lorentzian function of unit integral.
- Return type:
ndarray
Notes
The functional form of the Lorentzian is given by:
\[L(x) = \frac{1}{\pi} \frac{(\gamma/2)}{(x-c)^2 + (\gamma/2)^2}\]where \(\gamma\) is the full-width at half-maximum, and \(c\) is the center.
For n dimensions, the functional form of the Lorentzian is given by:
\[L(x_1, ..., x_n) = \frac{1}{n \pi} \frac{(\gamma/2)}{(\sum_i{(x_i - c_i)^2} + (\gamma/2)^2)^{\frac{1+n}{2}}}\]Example
>>> import numpy as np >>> from skued import lorentzian >>> >>> span = np.arange(-15, 15, 0.1) >>> xx, yy = np.meshgrid(span, span) >>> l = lorentzian( coordinates = [xx,yy], center = [0,0], fwhm = 1) >>> l.shape == xx.shape True >>> np.sum(l)*0.1**2 # Integral should be unity (spacing = 0.1) 0.9700030627398781