Skip to content

errors

BalanceEngineWarning

Bases: UserWarning

Base class for balance-related warnings.

ConvergenceError

ConvergenceError(
    message: str,
    origin: str = 'unknown',
    level: str = 'ERROR',
    details: str = '',
)

Bases: SolverError

Raised when solver fails to converge.

origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

Parameters:

Name Type Description Default

message

str

error message

required

origin

str

origin of the error. Defaults to "unknown"

'unknown'

level

str

error level. Defaults to "ERROR".

'ERROR'

details

str

error details. Defaults to "".

''

Examples:

1
2
3
4
5
6
>>> error = SolverError(
...     "An error occurred", level="CRITICAL", details="Matrix is singular"
... )
>>> error.origin = "MatrixSolver"
>>> raise error
[CRITICAL][MatrixSolver] An error occurred | Matrix is singular
Source code in src/mechaphlowers/entities/errors.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def __init__(
    self,
    message: str,
    origin: str = "unknown",
    level: str = "ERROR",
    details: str = "",
) -> None:
    """SolverError specific exception.

    origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

    Args:
        message (str): error message
        origin (str, optional): origin of the error. Defaults to "unknown"
        level (str, optional): error level. Defaults to "ERROR".
        details (str, optional): error details. Defaults to "".

    Examples:

        >>> error = SolverError(
        ...     "An error occurred", level="CRITICAL", details="Matrix is singular"
        ... )
        >>> error.origin = "MatrixSolver"
        >>> raise error
        [CRITICAL][MatrixSolver] An error occurred | Matrix is singular

    """
    self.level = level
    self.details = details
    self.origin = origin
    prefix = f"[{level}][{self.origin}]"

    super().__init__(f"{prefix} {message} | {details}")

DataWarning

Bases: UserWarning

Base class for data-related warnings.

GpsNoDataAvailable

Bases: AttributeError

Raised when GPS coordinates are requested but no starting point has been set.

InvalidManipulationIndex

Bases: ValueError

Raised when an invalid index is used in manipulation.

InvalidManipulationKeys

Bases: ValueError

Raised when invalid keys are used in manipulation.

InvalidManipulationRange

Bases: ValueError

Raised when a value is out of the allowed range in manipulation.

MeasurementDataNotAvailable

Bases: ValueError

Raised when measurement data are not available for computation.

RtsDataNotAvailable

Bases: ValueError

Raised when RTS catalog data (rts_cable, rts_layer_*) is missing or NaN.

ShapeError

Bases: ValueError

Raised when there is a shape mismatch in arrays.

SolverError

SolverError(
    message: str,
    origin: str = 'unknown',
    level: str = 'ERROR',
    details: str = '',
)

Bases: Exception

Base class for solver errors.

origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

Parameters:

Name Type Description Default

message

str

error message

required

origin

str

origin of the error. Defaults to "unknown"

'unknown'

level

str

error level. Defaults to "ERROR".

'ERROR'

details

str

error details. Defaults to "".

''

Examples:

1
2
3
4
5
6
>>> error = SolverError(
...     "An error occurred", level="CRITICAL", details="Matrix is singular"
... )
>>> error.origin = "MatrixSolver"
>>> raise error
[CRITICAL][MatrixSolver] An error occurred | Matrix is singular
Source code in src/mechaphlowers/entities/errors.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def __init__(
    self,
    message: str,
    origin: str = "unknown",
    level: str = "ERROR",
    details: str = "",
) -> None:
    """SolverError specific exception.

    origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

    Args:
        message (str): error message
        origin (str, optional): origin of the error. Defaults to "unknown"
        level (str, optional): error level. Defaults to "ERROR".
        details (str, optional): error details. Defaults to "".

    Examples:

        >>> error = SolverError(
        ...     "An error occurred", level="CRITICAL", details="Matrix is singular"
        ... )
        >>> error.origin = "MatrixSolver"
        >>> raise error
        [CRITICAL][MatrixSolver] An error occurred | Matrix is singular

    """
    self.level = level
    self.details = details
    self.origin = origin
    prefix = f"[{level}][{self.origin}]"

    super().__init__(f"{prefix} {message} | {details}")

SuspectedChainReversal

SuspectedChainReversal(
    message: str,
    origin: str = 'unknown',
    level: str = 'ERROR',
    details: str = '',
)

Bases: SolverError

Raised in solver when chain is suspected to be reversed (above horizontal position)

origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

Parameters:

Name Type Description Default

message

str

error message

required

origin

str

origin of the error. Defaults to "unknown"

'unknown'

level

str

error level. Defaults to "ERROR".

'ERROR'

details

str

error details. Defaults to "".

''

Examples:

1
2
3
4
5
6
>>> error = SolverError(
...     "An error occurred", level="CRITICAL", details="Matrix is singular"
... )
>>> error.origin = "MatrixSolver"
>>> raise error
[CRITICAL][MatrixSolver] An error occurred | Matrix is singular
Source code in src/mechaphlowers/entities/errors.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def __init__(
    self,
    message: str,
    origin: str = "unknown",
    level: str = "ERROR",
    details: str = "",
) -> None:
    """SolverError specific exception.

    origin attribute is available to add origin of the error (e.g., class name, calling function, etc.)

    Args:
        message (str): error message
        origin (str, optional): origin of the error. Defaults to "unknown"
        level (str, optional): error level. Defaults to "ERROR".
        details (str, optional): error details. Defaults to "".

    Examples:

        >>> error = SolverError(
        ...     "An error occurred", level="CRITICAL", details="Matrix is singular"
        ... )
        >>> error.origin = "MatrixSolver"
        >>> raise error
        [CRITICAL][MatrixSolver] An error occurred | Matrix is singular

    """
    self.level = level
    self.details = details
    self.origin = origin
    prefix = f"[{level}][{self.origin}]"

    super().__init__(f"{prefix} {message} | {details}")

UncertaintyNotAvailable

Bases: AttributeError

Raised when attempting to read uncertainty while it hasn't been computed.

ViewChoiceWarning

Bases: UserWarning

Base class for choice of view (ex: choice of support or span view).