fit_gaussian_2d

fit_gaussian_2d(data, fitmethod, verbose=False)[source]

fit the 2D distribution with 2D gaussian function

The fit success parameter is the parameter returned by the optimize.leastsq function.

Returns (height, x, y, sigma_x, sigma_y), the gaussian parameters of a 2D distribution found by a fit.

error is computed based on the covariance matrix.

Parameters:
  • data (2D array) – 2D distribution to fit
  • fitmethod (string) – fit method to be used: ‘gaussian_2d_fixedwidth’, ‘gaussian_2d_1width’ or ‘gaussian_2d_2width’
  • verbose (bool) – verbosity parameter. Default=False
Returns:

success_flag, fitparameters (height, x, y, sigma_x, sigma_y), error (=0 if success=0)

Return type:

bool, (floats), float