Fitting
- spinlab.fitting.general.fit(f, data, dim=None, p0=None, fit_points=None, sigma=None, absolute_sigma=False, check_finite=True, bounds=(-inf, inf), method=None, jac=None, **kwargs)
Fitting function for SpinData
- Parameters:
f (func) -- Function used in scipy.curve_fit
data (SpinData) -- Data for fit
dim (str or None) -- Dimension to perform fit along. If None, the first dimension is used.
p0 (tuple) -- Initial guess for fit
fit_points (int) -- Number of points to use in the fit. If None (default), the number of points is the same as the data.
kwargs -- Additional parameters for scipy.curve_fit
- Returns:
Dictionary of fit, fitting parameters, and error
- Return type:
out (dict)
Examples
>>> data = sl.load("path/to/data") >>> out = sl.fit(sl.lineshape.gaussian, data, dim="f2", p0=(0, 1)) >>> fit = out["fit"] >>> popt = out["popt"]