colour.utilities.ones

colour.utilities.ones(shape, dtype=None, order='C')[source]

Simple wrapper around np.ones() definition to create arrays with the active type defined by the:attr:colour.constant.DEFAULT_FLOAT_DTYPE attribute.

Parameters
  • shape (int or array_like) – Shape of the new array, e.g., (2, 3) or 2.

  • dtype (object) – Type to use for conversion, default to the type defined by the colour.constant.DEFAULT_FLOAT_DTYPE attribute.

  • order (unicode, optional) – {‘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

ndarray

Examples

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