neutronpy.functions.gaussian_ring

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

Returns a two dimensional gaussian ellipse profile.

Parameters:
p : ndarray

Parameters for the gaussian ellipse function, in the following format:

p[0] Constant background
p[1] Linear background slope
p[2] Volume under first ellipse
p[3] X position of first ellipse
p[4] Y position of first ellipse
p[5] Radius of first ellipse
p[6] Eccentricity of first ellipse
p[7] FWHM of first ellipse
p[8] Volume under second ellipse
p[…] etc.
q : tuple of ndarray

Two input arrays of equivalent size and shape, e.g. formed with numpy.meshgrid.

Returns:
out : ndarray

Two dimensional gaussian ellipse profile.

Notes

A gaussian ellipse profile is defined as

\[f(x,y) = \frac{1}{N} e^{-\frac{1}{2}\frac{(\sqrt{(x-x_0)^2 + \alpha^2(y-y_0)^2}-r_0)^2}{2 \sigma}},\]

where \(FWHM = 2\sqrt{2\ln(2)}\sigma\), and N is the normalization pre-factor given by

\[N = \frac{2\pi}{\alpha} \left(\sigma^2 e^{-\frac{r_0^2}{2\sigma^2}} + \sqrt{\frac{\pi}{2}} r_0 \sigma \left(1 + \mathrm{Erf}\left(\frac{r_0}{\sqrt{2}\sigma}\right)\right)\right).\]