colour.utilities.as_float_scalar#
- colour.utilities.as_float_scalar(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) float[source]#
Convert the specified variable \(a\) to
numpy.floatingusing the specifiednumpy.dtype.- Parameters:
a (ArrayLike) – Variable \(a\) to convert.
dtype (Type[DTypeFloat] | None) –
numpy.dtypeto use for conversion, default to thenumpy.dtypedefined by thecolour.constant.DTYPE_FLOAT_DEFAULTattribute.
- Returns:
Variable \(a\) converted to
numpy.floating.- Return type:
Warning
The return type is effectively annotated as
floatand notnumpy.floating.
Examples
>>> as_float_scalar(np.array(1)) 1.0