fit_gaussian_2d

fit_gaussian_2d(data, fit_method, fit_sigma, 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
  • fit_method (string) – fit method to be used: ‘gaussian_2d_fixedwidth’, ‘gaussian_2d_1width’ or ‘gaussian_2d_2width’
  • fit_sigma (float>0) – standard deviation of the gaussian fit_function. Default is 1.555.
  • 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