array_api

module of dascore.utils source

Utilities for working with the Python array API standard.

DASCore patch data can be backed by any array library which implements the array API standard. This module holds the small set of helpers needed to write backend-agnostic code and to cross the boundary back to numpy when a numpy-only implementation is used. Which array-likes are accepted as patch data is a separate question, and lives in compat.

Functions

Name Description
array_namespace Return the array API namespace shared by arrays.
asarray_like Return array converted to the backend and device of like.
backend_name Return the name of the array backend which owns array.
is_foreign Return True if the array belongs to a non-numpy array API backend.
is_numpy Return True if the array is a numpy array or scalar.
namespace_name Return the backend name of an array API namespace.
to_numpy Convert an array from any backend to a numpy array.
warn_numpy_fallback Warn that name has no implementation for the given array backend.