boilercore.fits
#
Model fits.
Module Contents#
Classes#
Model fit. |
Functions#
Fix edge-cases of lambdify where all inputs must be arrays. |
|
Get error parameters for model parameters. |
|
Get fits and errors for project model and plot the results. |
|
Get fits and errors for project model. |
|
Get fits and errors. |
|
Compose guesses. |
|
Compose bounds. |
|
Plot a model fit. |
|
Evaluate the model for x and return y with errors. |
|
Return parameters with errors given mappings, one with |
Data#
Minimum positive value to avoid divide-by-zero for affected parameters. |
|
Minimum positive convection coefficient to avoid instability of exponents. |
|
An initial guess not too close to zero to avoid iteration instability. |
|
Minimum temperature to avoid instability near absolute zero. |
|
Default color for measurement points. |
|
Confidence interval for a single sample from a student’s t-distribution. |
API#
- boilercore.fits.EPS: float#
None
Minimum positive value to avoid divide-by-zero for affected parameters.
- boilercore.fits.MIN_CONVECTION_COEFF#
0.001
Minimum positive convection coefficient to avoid instability of exponents.
- boilercore.fits.INIT_CONVECTION_COEFF#
1.0
An initial guess not too close to zero to avoid iteration instability.
- boilercore.fits.MIN_TEMP#
0.001
Minimum temperature to avoid instability near absolute zero.
- boilercore.fits.fix_model(
- f,
Fix edge-cases of lambdify where all inputs must be arrays.
See the notes section in the link below where it says, “However, in some cases the generated function relies on the input being a numpy array.”
https://docs.sympy.org/latest/modules/utilities/lambdify.html#sympy.utilities.lambdify.lambdify
- boilercore.fits.get_model_errors(
- params: list[sympy.Symbol],
Get error parameters for model parameters.
- class boilercore.fits.Fit#
Model fit.
- fixed_params: list[str]#
‘field(…)’
Parameters to fix. Evaluated before fitting, overridable in code.
- get_models(
- models: pathlib.Path,
Unpickle the model function for fitting data.
- boilercore.fits.XY_COLOR#
(0.2, 0.2, 0.2)
Default color for measurement points.
- boilercore.fits.CONFIDENCE_INTERVAL_95#
None
Confidence interval for a single sample from a student’s t-distribution.
- boilercore.fits.fit_and_plot(
- model: Any,
- params: boilercore.fits.Fit,
- x: Any,
- y: Any,
- y_errors: Any = None,
- confidence_interval=CONFIDENCE_INTERVAL_95,
- ax: matplotlib.axes.Axes | None = None,
- run: str | None = None,
Get fits and errors for project model and plot the results.
- boilercore.fits.fit_from_params(
- model: Any,
- params: boilercore.fits.Fit,
- x: Any,
- y: Any,
- y_errors: Any = None,
- confidence_interval: float = CONFIDENCE_INTERVAL_95,
- method: Literal[trf, dogbox] = 'trf',
Get fits and errors for project model.
- boilercore.fits.fit(
- model: Any,
- free_params: list[str],
- initial_values: collections.abc.Mapping[str, boilercore.types.Guess],
- model_bounds: collections.abc.Mapping[str, boilercore.types.Bound],
- x: Any,
- y: Any,
- y_errors: Any = None,
- confidence_interval: float = CONFIDENCE_INTERVAL_95,
- method: Literal[trf, dogbox] = 'trf',
Get fits and errors.
- boilercore.fits.get_guesses(
- params: collections.abc.Sequence[str],
- guesses: collections.abc.Mapping[str, boilercore.types.Guess],
Compose guesses.
- boilercore.fits.get_bounds(
- params: collections.abc.Sequence[str],
- bounds: collections.abc.Mapping[str, boilercore.types.Bound],
Compose bounds.
- boilercore.fits.plot_fit(
- model: Any,
- x: Any,
- y: Any,
- y_0: float,
- params: collections.abc.Mapping[str, Any],
- errors: collections.abc.Mapping[str, Any],
- y_errors: collections.abc.Sequence[Any] | None = None,
- ax: matplotlib.axes.Axes | None = None,
- run: str | None = None,
Plot a model fit.
- boilercore.fits.get_model_with_error(
- model,
- x,
- params,
- errors,
Evaluate the model for x and return y with errors.
- boilercore.fits.combine_params_and_errors(
- params: collections.abc.Mapping[str, Any],
- errors: collections.abc.Mapping[str, Any],
Return parameters with errors given mappings, one with
_err
-suffixed keys.