Curve-Fitting Plugin API
Curve-fitting plugins live in the top-level curvefitting folder. PhysPlot
reads these files to populate the curve-fitting configuration screen and to
choose the correct fitting routine.
Required Module Variables
DISPLAY_NAME: strThe fit name shown in the GUI list.
DEFAULT_LABEL: strThe default custom label text shown when a user selects custom labeling.
KIND: strThe fitting family. Use
"poly"for polynomial fits and"callable"for fits that provide their own model function.LABEL_MODES: tuple[str, ...]The allowed label modes. PhysPlot currently understands
"Off","Equation", and"Custom".
Polynomial Fit Variables
DEGREE: intRequired when
KIND = "poly". PhysPlot passes this value to the polynomial fitter.
Callable Fit Function
- function(x, *parameters) numpy.ndarray
Evaluate a custom model for curve fitting.
- Parameters:
x (array-like) – One-dimensional x-axis values from the selected data.
parameters (float) – Numeric fit parameters estimated by the curve fitter.
- Returns:
Model y-values evaluated at
x.- Return type:
numpy.ndarray
Included Fit Plugins
File |
Display name |
Kind |
Meaning |
|---|---|---|---|
|
|
|
First-degree polynomial. |
|
|
|
Second-degree polynomial. |
|
|
|
Third-degree polynomial. |
|
|
|
Fourth-degree polynomial. |
|
|
|
Fifth-degree polynomial. |
|
|
|
Sixth-degree polynomial. |
|
|
|
Seventh-degree polynomial. |
|
|
|
Eighth-degree polynomial. |
|
|
|
Ninth-degree polynomial. |
|
|
|
Tenth-degree polynomial. |
|
|
|
Exponential decay model. |
Implementation Notes
Keep fit files small. The file should describe one fit, not draw the plot or change the GUI directly. PhysPlot handles selecting x/y data, calculating the coefficients, drawing the fitted curve, and formatting labels.