integ_gaussian1D_erf#
- integ_gaussian1D_erf(x_edges, sigma, mu=0, normed=True)[source]#
Return a 1D Gaussian integrated over pixels (exact).
The integral over each pixel is computed analytically with the error function.
- Parameters:
x_edges (
numpy.ndarray) – Coordinates of the pixel edges, of shape(nx+1,).sigma (
floatornumpy.ndarray) – Gaussian standard deviation, scalar or of shape(nsig, 1), in the same units asx_edges.mu (
float, optional) – Center of the 1D Gaussian. Default is 0.normed (
bool, optional) – If True, use a unit-integral Gaussian; otherwise use a Gaussian of unit peak amplitude. Default is True.
- Returns:
numpy.ndarray– Integrated Gaussian of shapesigma.shape[:-1] + (nx,)((nx,)for a scalarsigma).
Examples
>>> x_edges = np.linspace(-10, 10, 41); sigma = 2 >>> np.isclose( ... integ_gaussian1D_erf(x_edges, sigma=sigma, normed=True).sum(), ... 1) np.True_ >>> np.isclose( ... integ_gaussian1D_erf(x_edges, sigma=sigma, normed=False).sum(), ... sigma * (2*np.pi)**0.5) np.True_