amep.functions.gaussian#

amep.functions.gaussian(x: ndarray, mu: float = 0.0, sig: float = 1.0, offset: float = 0.0, A: float = 1.0, normalized: bool = False) ndarray#

1D Gaussian.

Parameters:
  • x (np.ndarray) – x values.

  • mu (float) – Mean value.

  • sig (float) – Standard deviation.

  • offset (float, optional) – Shifts the Gaussian in y direction. The default is 0.0.

  • A (float, optional) – Amplitude. The default is 1.0.

  • normalized (bool, optional) – If True, the Gaussian is normalized to unit area. The default is False.

Returns:

g(x).

Return type:

np.ndarray

Examples

>>> import amep
>>> import numpy as np
>>> x = np.linspace(-10, 10, 200)
>>> y = amep.functions.gaussian(x, mu=0.0, sig=1.0)
>>> fig, axs = amep.plot.new()
>>> axs.plot(x,y)
>>> axs.set_xlabel(r"$x$")
>>> axs.set_ylabel(r"$f(x)$")
>>> fig.savefig("./figures/functions/functions-gaussian-function.png")
../_images/functions-gaussian-function.png