colour.utilities.as_array

colour.utilities.as_array(a, dtype=<class 'numpy.float64'>)[source]

Converts given \(a\) variable to ndarray with given type.

Parameters:
  • a (object) – Variable to convert.
  • dtype (object) – Type to use for conversion.
Returns:

\(a\) variable converted to ndarray.

Return type:

ndarray

Examples

>>> as_array([1, 2, 3])
array([ 1.,  2.,  3.])
>>> as_array([1, 2, 3], dtype=DEFAULT_INT_DTYPE)
array([1, 2, 3])