graphinglib.FitFromFunction.__init__#
- FitFromFunction.__init__(function: Callable, curve_to_be_fit: Curve | Scatter, label: str | None = None, guesses: ArrayLike | None = None, color: str = 'default', line_width: int | Literal['default'] = 'default', line_style: str = 'default')[source]#
Create a curve fit (continuous
Curve
) from aCurve
object using an arbitrary function passed as an argument.Fits a function of the form \(f(x, a, b, c, ...)\) to the given curve. All standard
Curve
attributes and methods are available.- Parameters:
- functionCallable
Function to be passed to the curve_fit function.
- curve_to_be_fit
Curve
orScatter
The object to be fit.
- labelstr, optional
Label to be displayed in the legend.
- guessesArrayLike, optional
Initial guesses for the parameters of the fit. Order is a, b, c, … as written above.
- colorstr
Color of the curve. Default depends on the
figure_style
configuration.- line_widthint
Line width of the curve. Default depends on the
figure_style
configuration.- line_stylestr
Line style of the curve. Default depends on the
figure_style
configuration.
- Attributes:
- parametersnp.ndarray
Parameters of the fit (same order as guesses).
- cov_matrixnp.ndarray
Covariance matrix of the parameters of the fit.
- standard_deviationnp.ndarray
Standard deviation of the parameters of the fit.
- functionCallable
Function with the parameters of the fit.