colour.utilities.tsplit#

colour.utilities.tsplit(a: ArrayLike, dtype: Type[DTypeBoolean] | Type[DTypeReal] | None = None) ndarray[Any, dtype[_ScalarType_co]][source]#

Split given stacked array \(a\) along the last axis (tail) to produce an array of arrays.

It is used to split a stacked array produced by the colour.utilities.tstack() definition.

Parameters:
  • a (ArrayLike) – Stacked array \(a\) to split.

  • dtype (Type[DTypeBoolean] | Type[DTypeReal] | None) – numpy.dtype to use for initial conversion to numpy.ndarray, default to the numpy.dtype defined by colour.constant.DTYPE_FLOAT_DEFAULT attribute.

Returns:

Array of arrays.

Return type:

numpy.ndarray

Examples

>>> a = np.array([0, 0, 0])
>>> tsplit(a)
array([ 0.,  0.,  0.])
>>> a = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5]])
>>> tsplit(a)
array([[ 0.,  1.,  2.,  3.,  4.,  5.],
       [ 0.,  1.,  2.,  3.,  4.,  5.],
       [ 0.,  1.,  2.,  3.,  4.,  5.]])
>>> a = np.array(
...     [
...         [
...             [0, 0, 0],
...             [1, 1, 1],
...             [2, 2, 2],
...             [3, 3, 3],
...             [4, 4, 4],
...             [5, 5, 5],
...         ]
...     ]
... )
>>> tsplit(a)
array([[[ 0.,  1.,  2.,  3.,  4.,  5.]],

       [[ 0.,  1.,  2.,  3.,  4.,  5.]],

       [[ 0.,  1.,  2.,  3.,  4.,  5.]]])