insight_gui.utils.misc module
- insight_gui.utils.misc.clamp(value: float, lower: float, upper: float) float
Clamp a value between two boundaries.
- Parameters:
value – number that will be clamped
lower – lower boundary of the clamping
upper – upper boundary of the clamping
- Returns:
clamped value
- insight_gui.utils.misc.is_between(value: float, lower: float, upper: float, incl_lower: bool = True, incl_upper: bool = True) bool
Check if a value is in between a lower and an upper boundary. Whether the boundaries are included can be specified.
- Parameters:
value – value to check
lower – lower boundary
upper – upper boundary
incl_lower – whether to include (<=) the lower boundary (vs exclude: <), defaults to True
incl_upper – whether to include (>=) the upper boundary (vs exclude: >), defaults to True
- Returns:
whether the value is in between the boundary