linear_fit

  • full name: tenpy.tools.fit.linear_fit

  • parent module: tenpy.tools.fit

  • type: function

tenpy.tools.fit.linear_fit(x, y)[source]

Perform a linear fit y ~ a * x + b.

Parameters:
  • x (array_like [M]) – The independent variable where the data is measured.

  • y (array_like [M]) – The dependent data.

Returns:

  • a (float) – The “slope” parameter of the fit function.

  • b (float) – They “y-intercept” parameter of the fit function.

  • res (float) – The (squared) residue, i.e. sum((y - (a * x + b)) ** 2).