fit module

gauss(x, *p)

Gauss distribution function.

Parameters
  • x – positions where the gauss function will be calculated

  • p

    gauss parameters [a, b, c, d]:

    • a – amplitude (integral = 1 if a = 1/(c*sqrt(2*pi)))

    • b – expected value mu (position of maximum, default = 0)

    • c – standard deviation sigma (variance sigma**2 = c**2)

    • d – vertical offset (default = 0)

Returns

array – gauss values at given positions x

gauss_fit(x, y, e=None, x_fit=None, verbose=False)

Fit Gauss distribution function to data.

Parameters
  • x – positions

  • y – values

  • e – error values

  • x_fit – positions of fitted function (default steps is 3*len(x) but min 150)

Returns

  • y_fit – values

  • popt – parameters of gauss distribution function (amplitude a, expected value mu, standard deviation sigma, vertical offset d)

  • FWHM – full width at half maximum

main()

test function