colour.utilities.ones#

colour.utilities.ones(shape: Union[Integer, Tuple[int, ...]], dtype: Optional[Type[DTypeNumber]] = None, order: Literal['C', 'F'] = 'C') NDArray[source]#

Wrap np.ones() definition to create an array with the active numpy.dtype defined by the colour.constant.DEFAULT_FLOAT_DTYPE attribute.

Parameters
  • shape (Union[Integer, Tuple[int, ...]]) – Shape of the new array, e.g., (2, 3) or 2.

  • dtype (Optional[Type[DTypeNumber]]) – numpy.dtype to use for conversion, default to the numpy.dtype defined by the colour.constant.DEFAULT_FLOAT_DTYPE attribute.

  • 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 given shape and type, filled with ones.

Return type

numpy.ndarray

Examples

>>> ones(3)
array([ 1.,  1.,  1.])