xsimlab.validators.in_bounds(bounds, closed=(True, True))

A validator that raises a ValueError if a given value is out of the given bounded interval.

It works with scalar values as well as with arrays (element-wise check).

  • bounds (tuple) – Lower and upper value bounds. Use None for either lower or upper value to set half-bounded intervals.

  • closed (tuple, optional) – Set an open, half-open or closed interval, i.e., whether the lower and/or upper bound is included or not in the interval. Default: closed interval (i.e., includes both lower and upper bounds).