skued.gaussian
- skued.gaussian(coordinates, center, fwhm=None, std=None)
Unit integral Gaussian function.
- Parameters:
coordinates (ndarray or list of ndarrays) – 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 gaussian. Should be the same shape as coordinates.ndim.
fwhm (float or None, optional) – Full-width at half-max of the function. Either std or fwhm must be provided.
std (float or None, optional) – Standard deviation of the function. Either std or fwhm must be provided.
- Returns:
out – Gaussian function of unit integral.
- Return type:
ndarray
:raises ValueError : If fwhm and std are not provided.:
Notes
In the case where both std and fwhm are given, fwhm takes precedence.
Examples
>>> import numpy as np >>> from skued import gaussian >>> >>> span = np.arange(-10, 10, 0.1) >>> xx, yy = np.meshgrid(span, span) >>> g = gaussian( coordinates = [xx,yy], center = [0,0], std = 1) >>> g.shape == xx.shape True >>> float(np.sum(g)*0.1**2) # Integral should be close to unity (spacing = 0.1) 1.0000000000000075