Source code for pymultifit.distributions.backend.errorHandling
"""Created on Dec 09 02:28:10 2024"""
neg_message = "cannot be negative."
[docs]
class BaseDistributionError(Exception):
"""Base class for distribution-related errors."""
pass
[docs]
class DegreeOfFreedomError(BaseDistributionError):
"""Raised when the degree of freedom is a float instead of int."""
def __init__(self):
super().__init__(r"DOF can only be integer, N+")
[docs]
class NegativeAlphaError(BaseDistributionError):
"""Raised when the alpha parameter value is negative."""
def __init__(self):
super().__init__(f"Alpha {neg_message}.")
[docs]
class NegativeAmplitudeError(BaseDistributionError):
"""Raised when the amplitude is negative."""
def __init__(self):
super().__init__(f"Amplitude {neg_message}")
[docs]
class NegativeBetaError(BaseDistributionError):
"""Raised when the beta parameter value is negative."""
def __init__(self):
super().__init__(f"Beta {neg_message}")
[docs]
class NegativeRateError(BaseDistributionError):
"""Raised when the value of rate parameter is negative."""
def __init__(self):
super().__init__(f"Rate {neg_message}")
[docs]
class NegativeScaleError(BaseDistributionError):
"""Raised when the value of scale parameter is negative."""
def __init__(self, parameter='scale'):
super().__init__(f"{parameter.capitalize()} {neg_message}")
[docs]
class NegativeShapeError(BaseDistributionError):
"""Raised when the value of shape parameter is negative."""
def __init__(self):
super().__init__(f"Shape {neg_message}")
[docs]
class NegativeStandardDeviationError(BaseDistributionError):
"""Raised when the standard deviation is negative."""
def __init__(self):
super().__init__(f"Standard deviation {neg_message}")
[docs]
class NegativeVarianceError(BaseDistributionError):
"""Raised when the variance value is negative."""
def __init__(self):
super().__init__("Variance cannot be negative.")
[docs]
class XOutOfRange(BaseDistributionError):
"""Raised when the x value is out of range for the distribution."""
def __init__(self):
super().__init__("X out of range.")