InvalidLimitsError(limits, empty_bracket=None)
Source¶
Bases: NumdaplotError
Raised when the limits of Brackets do not form valid brackets.
The limits must strictly increase, and form at least one bracket. On a column of integers, each bracket between two limits must hold an integer.
Added in version 0.1.0
Parameters:
-
limits(list[int | float])The limits of the brackets.
-
empty_bracket(list[int | float] | None, default:None)The low and the high limit of a bracket holding no integer, when the limits are valid but that bracket is not. When omitted, the limits themselves are wrong.
Attributes:
-
limitsThe limits of the brackets.
-
empty_bracketThe limits of the bracket holding no integer,
Nonewhen the limits themselves are wrong.
Examples:
import numdaplot as ndp
try:
ndp.Brackets(limits=[0, 10, 10])
except ndp.InvalidLimitsError as error:
print(error)
# Expected limits in strictly increasing order, got 10 after 10.
try:
ndp.Brackets(limits=[0])
except ndp.InvalidLimitsError as error:
print(error)
# Expected at least 2 limits, or 1 with an open first or last bracket, got 1.