Array interface¶
Note
This section characterizes protocols for backends. The purpose of a protocol is to provide support for nominal and structural subtyping.
Next to backends, dataset, and axes, nata provides objects to have an array
interface. Inside nata, a interface is determined by HasArrayInterface
protocol. It is especially important to allow dispatching for numpy.
-
class
nata.types.
HasArrayInterface
(*args, **kwds)¶ Bases:
typing_extensions.Protocol
Base protocol for an object to be ‘characterized’ as an array.
-
__array__
(dtype: Optional[numpy.dtype] = None) → numpy.ndarray¶ Array interface of an object.
Method which will be called when
numpy.array
or similar function called with the object provided as an input.
-
data
: numpy.ndarray¶ Represents the stored data for an object. It is of type
numpy.ndarray
.
-
dtype
: numpy.dtype¶ Data type object of the stored data. It is of type
numpy.dtype
.
-
shape
: Tuple[int, …]¶ Shape of the underlaying stored data. Similar to
numpy.ndarray.shape
-
ndim
: int¶ Dimensionality of the underlaying stored data. Similar to
numpy.ndarray.ndim
-