colour.utilities.as_float_scalar¶
- colour.utilities.as_float_scalar(a: NumberOrArrayLike, dtype: Optional[Type[DTypeFloating]] = None) Floating[source]¶
Convert given \(a\) variable to
numpy.floatingusing givennumpy.dtype.- Parameters
a (NumberOrArrayLike) – Variable to convert.
dtype (Optional[Type[DTypeFloating]]) –
numpy.dtypeto use for conversion, default to thenumpy.dtypedefined by thecolour.constant.DEFAULT_FLOAT_DTYPEattribute.
- Returns
\(a\) variable converted to
numpy.floating.- Return type
Examples
>>> as_float_scalar(np.array(1)) 1.0