colour.utilities.array_namespace#

colour.utilities.array_namespace(*arrays: Any) → ProtocolArrayNamespace[source]#

Return the array namespace for the specified arrays.

When Array API dispatch is disabled (default), return numpy. When enabled, use array_api_compat.array_namespace() to detect the appropriate namespace from the input arrays.

Parameters:

*arrays (Any) – Arrays to determine the namespace from. NumPy is returned as the explicit default fallback when no arrays are provided or all arrays are None / pure-Python scalars (no backend signal to dispatch on).

Returns:

Array namespace module.

Return type:

colour.hints.ProtocolArrayNamespace

Examples

>>> array_namespace(np.array([1, 2, 3]))
<module 'numpy'...>