multigaussfit

gaussfitter.multigaussfit(xax, data, ngauss=1, err=None, params=[1, 0, 1], fixed=[False, False, False], limitedmin=[False, False, True], limitedmax=[False, False, False], minpars=[0, 0, 0], maxpars=[0, 0, 0], quiet=True, shh=True, veryverbose=False)[source] [edit on github]

An improvement on onedgaussfit. Lets you fit multiple gaussians.

Parameters:

xax : np.array

x axis

data : np.array

y axis

err : np.array or None

error corresponding to data

ngauss : int

How many gaussians to fit? Default 1 (this could supersede onedgaussfit). Parameters below need to have lenght of 3*ngauss. If ngauss>1 and their lenght is 3, they will be replicated ngaus times, otherwise they will be reset to defaults.

params : list

Fit parameters: [amplitude, offset, width] * ngauss If len(params) % 3 == 0, ngauss will be set to len(params) / 3

fixed : list of bools

Is parameter fixed?

limitedmin/minpars : list

set lower limits on each parameter (default: width>0)

limitedmax/maxpars : list

set upper limits on each parameter

minpars : list

maxpars : list

quiet : bool

should MPFIT output each iteration?

shh : bool

output final parameters?

veryverbose : bool

Returns:

Fit parameters

Model

Fit errors

chi2