twodgaussian

gaussfitter.twodgaussian(inpars, circle=False, rotate=True, vheight=True, shape=None)[source] [edit on github]

Returns a 2d gaussian function of the form: x’ = np.cos(rota) * x - np.sin(rota) * y y’ = np.sin(rota) * x + np.cos(rota) * y (rota should be in degrees) g = b + a * np.exp ( - ( ((x-center_x)/width_x)**2 + ((y-center_y)/width_y)**2 ) / 2 )

inpars = [b,a,center_x,center_y,width_x,width_y,rota]
(b is background height, a is peak amplitude)

where x and y are the input parameters of the returned function, and all other parameters are specified by this function

However, the above values are passed by list. The list should be: inpars = (height,amplitude,center_x,center_y,width_x,width_y,rota)

You can choose to ignore / neglect some of the above input parameters using the following options:

Parameters:

circle : bool

default is an elliptical gaussian (different x, y widths), but can reduce the input by one parameter if it’s a circular gaussian

rotate : bool

default allows rotation of the gaussian ellipse. Can remove last parameter by setting rotate=0

vheight : bool

default allows a variable height-above-zero, i.e. an additive constant for the Gaussian function. Can remove first parameter by setting this to 0

shape : tuple

if shape is set (to a 2-parameter list) then returns an image with the gaussian defined by inpars