WrightTools.kit.leastsqfitter

WrightTools.kit.leastsqfitter(p0, datax, datay, function, verbose=False, cov_verbose=False)[source]

Conveniently call scipy.optmize.leastsq().

Returns fit parameters and their errors.

Parameters:
  • p0 (list) – list of guess parameters to pass to function

  • datax (array) – array of independent values

  • datay (array) – array of dependent values

  • function (function) – function object to fit data to. Must be of the callable form function(p, x)

  • verbose (bool) – toggles printing of fit time, fit params, and fit param errors

  • cov_verbose (bool) – toggles printing of covarience matrix

Returns:

  • pfit_leastsq (list) – list of fit parameters. s.t. the error between datay and function(p, datax) is minimized

  • perr_leastsq (list) – list of fit parameter errors (1 std)