colour.utilities.tstack#
- colour.utilities.tstack(a: ArrayLike, dtype: Type[DTypeBoolean] | Type[DTypeReal] | None = None) ndarray[Any, dtype[_ScalarType_co]] [source]#
Stack given array of arrays \(a\) along the last axis (tail) to produce a stacked array.
It is 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.dtype
to use for initial conversion tonumpy.ndarray
, default to thenumpy.dtype
defined bycolour.constant.DEFAULT_FLOAT_DTYPE
attribute.
- 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.]]]])