colour.utilities.tsplit

colour.utilities.tsplit(a, dtype=None)[source]

Splits arrays in sequence along the last axis (tail).

Parameters
  • a (array_like) – Array to perform the splitting.

  • dtype (object) – Type to use for initial conversion to ndarray, default to the type defined by colour.constant.DEFAULT_FLOAT_DTYPE attribute.

Returns

Return type

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.]]])