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:
a (ArrayLike) – Array of arrays \(a\) to stack along the last axis.
dtype (Type[DTypeBoolean] | Type[DTypeReal] | None) –
numpy.dtypeto use for initial conversion tonumpy.ndarray, default to thenumpy.dtypedefined bycolour.constant.DTYPE_FLOAT_DEFAULTattribute.
- Returns:
Stacked array.
- Return type:
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.]]]])