satlas.stats.fitting.chisquare_fit

satlas.stats.fitting.chisquare_fit(f, x, y, yerr=None, xerr=None, func=None, verbose=True, hessian=False, method='leastsq')[source]

Use a non-linear least squares minimization (Levenberg-Marquardt) algorithm to minimize the chi-square of the fit to data x and y with errorbars yerr.

Parameters:
  • f (BaseModel) – Model object containing all the information about the fit; will be fitted to the given data.
  • x (array_like) – Experimental data for the x-axis.
  • y (array_like) – Experimental data for the y-axis.
  • yerr (array_like) – Uncertainties on y.
Other Parameters:
 
  • xerr (array_like, optional) – Uncertainties on x.
  • func (function, optional) – Uses the provided function on the fitvalue to calculate the errorbars.
  • verbose (boolean, optional) – When set to True, a tqdm-progressbar in the terminal is maintained. Defaults to True.
  • hessian (boolean, optional) – When set to True, the SATLAS implementation of the Hessian uncertainty estimate is calculated, otherwise the LMFIT version is used. Defaults to False.
  • method (string, optional) – Sets the method to be used by lmfit for the fitting. See lmfit for all options.
Returns:

success, message – Boolean indicating the success of the convergence, and the message from the optimizer.

Return type:

tuple