colour.utilities.interval#

colour.utilities.interval(distribution: ArrayLike, unique: bool = True) → NDArray[source]#

Return the interval size of the specified distribution.

Parameters:
  • distribution (ArrayLike) – Distribution to retrieve the interval from.

  • unique (bool) – Whether to return unique intervals if the distribution is non-uniformly spaced or the complete intervals.

Returns:

Distribution interval.

Return type:

numpy.ndarray

Examples

Uniformly spaced variable:

>>> y = np.array([1, 2, 3, 4, 5])
>>> interval(y)
array([1.])
>>> interval(y, False)
array([1., 1., 1., 1.])

Non-uniformly spaced variable:

>>> y = np.array([1, 2, 3, 4, 8])
>>> interval(y)
array([1., 4.])
>>> interval(y, False)
array([1., 1., 1., 4.])

Distribution with a single element or empty distribution, i.e. without any defined interval:

>>> interval(np.array([1]))
array([], dtype=float64)
>>> interval(np.array([]))
array([], dtype=float64)