- 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.odrwith the syntax ofscipy.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
xdata.- sigma_yndarray | Iterable
The $1\sigma$ uncertainty of the
ydata.- 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. Ifp0isNone, 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
boolvalues specifying whether to fix a parameter. Must have the same length asp0.- 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.