ioRange

utilipy.data_utils.ioRange(incl: Union[None, tuple, numpy.array] = None, excl: Union[None, tuple, numpy.array] = None, rng: Union[Sequence, ellipsis] = Ellipsis, *, as_ind: bool = False) → numpy.array[source]

Supports inRange and outRange.

Parameters
inclarray_like, optional

args into inRange must be a tuple if many args, not a tuple else

exclarray_like, optional

args into outRange must be a tuple if many args, not a tuple else

rngSequence or Ellipsis, optional

concatenated list of (in)outRange rng must be in orgder of [inRange rng, outRange rng]

as_indbool

(default False) whether to return bool array or the indices (where(bool array == True)) sets the default behavior for the wrapped function

Returns
outndarray of bool or ndarray of ints

boolean array to select values inside / outside box selection if as_ind, then index array of same

Other Parameters
as_indbool or “flatten”, optional

(default False) whether to return a boolean array, or array of indices.

Raises
ValueError

if as_ind is “flatten” and cannot be flattened (len > 1)