colour.utilities.ones#
- colour.utilities.ones(shape: int | Sequence[int], dtype: Type[DTypeReal] | None = None) NDArray[source]#
Create an array of ones with the active dtype.
Wrap
np.ones()definition to create an array with the activenumpy.dtypedefined by thecolour.constant.DTYPE_FLOAT_DEFAULTattribute.- Parameters:
shape (int | Sequence[int]) – Shape of the new array, e.g.,
(2, 3)or2.dtype (Type[DTypeReal] | None) –
numpy.dtypeto use for conversion, default to thenumpy.dtypedefined by thecolour.constant.DTYPE_FLOAT_DEFAULTattribute.
- Returns:
Array of the specified shape and
numpy.dtype, filled with ones.- Return type:
Examples
>>> ones(3) array([1., 1., 1.])