colour.utilities.as_float_scalar#
- colour.utilities.as_float_scalar(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) float [source]#
Convert given \(a\) variable to
numpy.floating
using givennumpy.dtype
.- Parameters:
a (ArrayLike) – Variable to convert.
dtype (Type[DTypeFloat] | None) –
numpy.dtype
to use for conversion, default to thenumpy.dtype
defined by thecolour.constant.DEFAULT_FLOAT_DTYPE
attribute.
- Returns:
\(a\) variable converted to
numpy.floating
.- Return type:
Warning
The return type is effectively annotated as
float
and notnumpy.floating
.
Examples
>>> as_float_scalar(np.array(1)) 1.0