graphinglib.FitFromGaussian.__init__#
- FitFromGaussian.__init__(curve_to_be_fit: Curve | Scatter, label: str | None = None, guesses: TypeAliasForwardRef('ArrayLike') | None = None, color: str | Inherit = Inherit, line_width: int | Inherit = Inherit, line_style: str | Inherit = Inherit, alpha: float | Inherit = Inherit, max_iterations: int = 10000) None[source]#
Create a curve fit (continuous
Curve) from an existingCurveobject using a gaussian fit.Fits a gaussian function of the form \(f(x) = A e^{-\frac{(x - \mu)^2}{2 \sigma^2}}\) to the given curve. All standard
Curveattributes and methods are available.- Parameters:
- curve_to_be_fit
CurveorScatter The object to be fit.
- labelstr, optional
Label to be displayed in the legend.
- guessesArrayLike, optional
Initial guesses for the parameters of the fit.
- colorstr
Color of the curve. Default depends on the
figure_styleconfiguration.- line_widthint
Line width of the curve. Typical range is
0.5to4. Default depends on thefigure_styleconfiguration.- line_stylestr
Line style of the curve. Values include
"-","--","-.",":","solid","dashed","dashdot", and"dotted". Default depends on thefigure_styleconfiguration.- alphafloat
Opacity of the curve. Range is
0(transparent) to1(opaque). Default depends on thefigure_styleconfiguration.- max_iterationsint
Maximum number of iterations for the fit. Default is 10000.
- curve_to_be_fit
- Attributes:
- amplitudefloat
Amplitude of the gaussian function.
- meanfloat
Mean of the gaussian function.
- standard_deviationfloat
Standard deviation of the gaussian function.
- cov_matrixnp.ndarray
Covariance matrix of the parameters of the fit.
- standard_deviation_of_fit_paramsnp.ndarray
Standard deviation of the parameters of the fit.
- functionCallable
Gaussian function with the parameters of the fit.
Notes
Color parameters accept Matplotlib color formats: named colors (
"blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between0and1((0, 0, 1)or(0, 0, 1, 0.5)).