Source code for fitwise.warnings

"""Warnings that flag fit results which should not be trusted blindly.

Every warning is stored in :attr:`fitwise.FitResult.warnings`, printed in the report and
emitted through Python's :mod:`warnings` machinery. Silence them with the standard filters,
for example ``warnings.simplefilter("ignore", fitwise.warnings.StrongCorrelationWarning)``.
"""

__all__ = [
    "FitWarning",
    "LargeUncertaintyWarning",
    "NotConvergedWarning",
    "ParameterAtBoundWarning",
    "PoorChiSquareWarning",
    "SingularCovarianceWarning",
    "StrongCorrelationWarning",
]


[docs] class FitWarning(UserWarning): """Base class of all fitwise warnings."""
[docs] class NotConvergedWarning(FitWarning): """The solver stopped without meeting its convergence criteria."""
[docs] class SingularCovarianceWarning(FitWarning): """The covariance matrix could not be estimated; parameters may be unidentifiable."""
[docs] class ParameterAtBoundWarning(FitWarning): """A parameter ended at one of its bounds; its uncertainty is unreliable."""
[docs] class PoorChiSquareWarning(FitWarning): """χ²/ndf is implausible for the given ``yerr``: wrong model or wrong uncertainties."""
[docs] class StrongCorrelationWarning(FitWarning): """Two parameters are almost fully correlated (absolute correlation above 0.999). The data then determine only a combination of the two. Their individual uncertainties are correct but large; combine them using the covariance, or reparametrize the model. """
[docs] class LargeUncertaintyWarning(FitWarning): """A parameter's standard error exceeds its absolute value."""