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
all([axis, keepdims])Test whether all array elements along a given axis evaluate to True.
any([axis, keepdims])Test whether any array element along a given axis evaluates to True.
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.
max([axis, keepdims])Return the maximum along a given axis.
mean([axis, dtype, keepdims])Return the arithmetic mean along the specified axis.
min([axis, keepdims])Return the minimum along a given axis.
prod([axis, dtype, keepdims])Return the product of array elements over a given axis.
std([axis, dtype, ddof, keepdims])Return the standard deviation along the specified axis.
sum([axis, dtype, keepdims])Return the sum of array elements over a given axis.
to_device(device)Copy the array from the device on which it currently resides to the specified device.
var([axis, dtype, ddof, keepdims])Return the variance along the specified axis.
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.