colour.utilities.tstack#

colour.utilities.tstack(a: ArrayLike, dtype: Type[DTypeBoolean] | Type[DTypeReal] | None = None) NDArray[source]#

Stack the specified array of arrays \(a\) along the last axis (tail) to produce a stacked array.

Used to stack an array of arrays produced by the colour.utilities.tsplit() definition.

Parameters:
Returns:

Stacked array.

Return type:

numpy.ndarray

Notes

  • The returned array is always a freshly-allocated, contiguous stack of the components along the last axis and never aliases the inputs. It is the inverse of the colour.utilities.tsplit() definition, whose NumPy path likewise returns an independent, contiguous copy.

Examples

>>> a = 0
>>> tstack([a, a, a])
array([0., 0., 0.])
>>> a = np.arange(0, 6)
>>> tstack([a, a, a])
array([[0., 0., 0.],
       [1., 1., 1.],
       [2., 2., 2.],
       [3., 3., 3.],
       [4., 4., 4.],
       [5., 5., 5.]])
>>> a = np.reshape(a, (1, 6))
>>> tstack([a, a, a])
array([[[0., 0., 0.],
        [1., 1., 1.],
        [2., 2., 2.],
        [3., 3., 3.],
        [4., 4., 4.],
        [5., 5., 5.]]])
>>> a = np.reshape(a, (1, 1, 6))
>>> tstack([a, a, a])
array([[[[0., 0., 0.],
         [1., 1., 1.],
         [2., 2., 2.],
         [3., 3., 3.],
         [4., 4., 4.],
         [5., 5., 5.]]]])