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.curve_fit  (  f x y p0 = None p0_fixed = None sigma = None absolute_sigma = False check_finite = True bounds = (-inf, inf) method = None jac = None full_output = False report = False ** kwargs  )[source]

Parameters:
fCallable

The model function to fit to the data.

xarray_like | object

The x data.

yarray_like

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_fixedndarray | Iterable

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

sigmandarray | Iterable | Callable

The 1-sigma uncertainty of the y data. This can also be a function g such that 'g(x, y, f(x, *params), *params) -> sigma'.

absolute_sigmabool

See scipy.optimize.curve_fit.

check_finitebool

See scipy.optimize.curve_fit.

bounds(ndarray, ndarray)

See scipy.optimize.curve_fit.

methodstr

See scipy.optimize.curve_fit.

jacCallable | str

See scipy.optimize.curve_fit. Must not be callable if 'sigma' is callable.

full_outputbool

See scipy.optimize.curve_fit.

reportbool

Whether to print the result of the fit.

kwargsNone

See scipy.optimize.curve_fit.

Returns:
outNone

popt, pcov. The optimal parameters and their covariance matrix. Additional output if full_output is True. See scipy.optimize.curve_fit.

API navigation