symop.modes.types¶
Shared type aliases and small utility helpers for mode handling.
This module centralizes common array type aliases and lightweight
validation helpers used across the symop.modes subpackage.
It also provides utilities for normalizing Matplotlib Axes inputs and validating floating-point parameters.
Functions
Convert input to a NumPy array with |
|
|
Normalize Axes-like inputs to a consistent array representation. |
|
Validate that a float is finite. |
|
Validate that a float is strictly positive and finite. |
Classes
|
Minimal protocol for objects exposing get_figure(). |
- class HasGetFigure(*args, **kwargs)¶
Bases:
ProtocolMinimal protocol for objects exposing get_figure().
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = True¶
- as_float_array(x: Any) ndarray[tuple[Any, ...], dtype[float64]]¶
Convert input to a NumPy array with
dtype=float.This is a small convenience used throughout
symop.modesto normalize array-like inputs (lists, tuples, NumPy arrays) to a floating-point NumPy array.- Parameters:
x (
Any) – Array-like input.- Returns:
NumPy array view/copy with
dtype=float.- Return type:
FloatArray
- coerce_axes_array(axes: HasGetFigure | Sequence[HasGetFigure] | ndarray[tuple[Any, ...], dtype[Any]]) tuple[FigureBase, ndarray[tuple[Any, ...], dtype[Any]]]¶
Normalize Axes-like inputs to a consistent array representation.
- Parameters:
axes (HasGetFigure | Sequence[HasGetFigure] | ndarray[tuple[Any, ...], dtype[Any]])
- Return type:
- require_finite(name: str, x: float) float¶
Validate that a float is finite.
- Parameters:
- Returns:
The validated value.
- Return type:
- Raises:
ValueError – If
xis not finite.
- require_pos_finite(name: str, x: float) float¶
Validate that a float is strictly positive and finite.
- Parameters:
- Returns:
The validated value.
- Return type:
- Raises:
ValueError – If
xis not finite or not strictly positive.