SimpleProxy¶
Simple proxy for a NumPy array (or similar) that can be used with the Blosc2 compute engine.
This only supports the __getitem__ method. No caching is performed.
- class blosc2.SimpleProxy(src, chunks: tuple | None = None, blocks: tuple | None = None)[source]¶
Simple proxy for any data container to be used with the compute engine.
The source must have a shape and dtype attributes; if not, it will be converted to a NumPy array via the np.asarray function. It should also have a __getitem__ method.
This only supports the __getitem__ method. No caching is performed.
Examples
>>> import numpy as np >>> import blosc2 >>> a = np.arange(20, dtype=np.float32).reshape(4, 5) >>> proxy = blosc2.SimpleProxy(a) >>> proxy[1:3, 2:4] [[ 7. 8.] [12. 13.]]
- Attributes:
Methods
argmax([axis, keepdims])Returns the indices of the maximum values along a specified axis.
argmin([axis, keepdims])Returns the indices of the minimum values along a specified axis.
item()Copy an element of an array to a standard Python scalar and return it.
to_device(device)Copy the array from the device on which it currently resides to the specified device.
where([value1, value2])Select
value1orvalue2values based onTrue/Falseforself.- Special Methods:
__init__(src[, chunks, blocks])__getitem__(item)Get a slice as a numpy.ndarray (via this proxy).
Constructor¶
Utility Methods¶
- __getitem__(item: slice | list[slice]) ndarray[source]¶
Get a slice as a numpy.ndarray (via this proxy).
- Parameters:
item¶
- Returns:
out – An array with the data slice.
- Return type:
numpy.ndarray
- property dtype¶
The data type of the source array.
- property ndim¶
The number of dimensions of the source array.
- property shape¶
The shape of the source array.
- property src¶
The source object that this proxy wraps.