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.odr_fit  (  f x y sigma_x = None sigma_y = None p0 = None p0_d = None p0_fixed = None report = False ** kwargs  )[source]

This function encapsulates the orthogonal distance regression (ODR) routine scipy.odr.odr with the syntax of scipy.optimize.curve_fit.

Parameters:
fCallable

The model function $f$ to fit to the data.

xndarray | Iterable

The $x$ data.

yndarray | Iterable

The $y$ data.

sigma_xndarray | Iterable

The $1\sigma$ uncertainty of the x data.

sigma_yndarray | Iterable

The $1\sigma$ uncertainty of the y data.

p0ndarray | Iterable

A numpy array or an Iterable of the initial guesses for the parameters. Must have at least the same length as the minimum number of parameters required by the function f. If p0 is None, 1 is taken as an initial guess for all non-keyword parameters.

p0_dndarray | Iterable

A numpy array or an Iterable of the standard deviations of the initial guesses for the parameters. Must have the same length as p0.

p0_fixedndarray | Iterable

A numpy array or an Iterable of bool values specifying whether to fix a parameter. Must have the same length as p0.

reportbool

Whether to print the result of the fit.

kwargsNone

Additional keyword arguments are passed to scipy.odr.ODR.

Returns:
(popt, pcov)(ndarray, ndarray)

The optimal parameters and their covariance matrix.

API navigation