colour.utilities.ones#
- colour.utilities.ones(shape: int | Sequence[int], dtype: Type[DTypeReal] | None = None, order: Literal['C', 'F'] = 'C') 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.order (Literal['C', 'F']) – Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
- Returns:
Array of the specified shape and
numpy.dtype, filled with ones.- Return type:
Examples
>>> ones(3) array([ 1., 1., 1.])