colour.utilities.as_float_scalar#

colour.utilities.as_float_scalar(a: NumberOrArrayLike, dtype: Optional[Type[DTypeFloating]] = None) float[source]#

Convert given \(a\) variable to numpy.floating using given numpy.dtype.

Parameters:
  • a (NumberOrArrayLike) – Variable to convert.

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

Returns:

\(a\) variable converted to numpy.floating.

Return type:

numpy.floating

Examples

>>> as_float_scalar(np.array(1))
1.0