Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2025 Patrick Müller. All rights reserved.

qspec.analyze.linear_fit  (  x y sigma_x = None sigma_y = None corr = None report = False ** kwargs  )[source]

Maximum likelihood fit for a straight line in 2d. This is a wrapper for the more general 'linear_nd_fit' function.

Parameters:
xndarray | Iterable

The x data.

yndarray | Iterable

The y data.

sigma_xndarray | Iterable

The 1-sigma uncertainties of the x data.

sigma_yndarray | Iterable

The 1-sigma uncertainties of the y data.

corrndarray | Iterable

The correlation coefficients between the x and y data.

reportbool

Whether to print the result of the fit.

kwargsNone

Additional keyword arguments.

Returns:
outNone

popt, pcov. The best y-intercept and slope and their covariance matrix.

API navigation