ch5mpy.H5Array

class ch5mpy.H5Array(dset)[source]

Wrapper around Dataset objects to interface with numpy’s API.

Attributes

H5Array.MAX_MEM_USAGE

H5Array.chunk_size

Get the size of a chunk (i.e.

H5Array.dset

H5Array.dtype

H5Array.is_chunked

H5Array.ndim

H5Array.shape

H5Array.size

Methods

H5Array.__init__

H5Array.astype

Cast an H5Array to a specified dtype.

H5Array.contract

Resize an H5Array by removing amount elements along the selected axis.

H5Array.copy

rtype:

ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]

H5Array.expand

Resize an H5Array by adding amount elements along the selected axis.

H5Array.iter_chunks

rtype:

ChunkIterator

H5Array.iter_chunks_with

rtype:

PairedChunkIterator

H5Array.maptype

Cast an H5Array to any object type.

H5Array.max

rtype:

Union[TypeVar(_T, bound= generic, covariant=True), ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]]

H5Array.mean

rtype:

Union[Any, ndarray[Any, dtype[Any]]]

H5Array.min

rtype:

Union[TypeVar(_T, bound= generic, covariant=True), ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]]

H5Array.read_direct

rtype:

None

Parameters:

dset (Dataset[_T] | DatasetWrapper[_T]) –

Attributes

H5Array.MAX_MEM_USAGE: int | str = '250M'
H5Array.chunk_size

Get the size of a chunk (i.e. the nb of elements that can be read/written at a time).

H5Array.dset
H5Array.dtype
H5Array.is_chunked
H5Array.ndim
H5Array.shape
H5Array.size

Methods

H5Array.__init__(dset)[source]
Parameters:

dset (Dataset[_T] | DatasetWrapper[_T]) –

H5Array.astype(dtype, inplace=False)[source]

Cast an H5Array to a specified dtype. This does not perform a copy, it returns a wrapper around the underlying H5 dataset.

Return type:

H5Array[Any]

Parameters:
H5Array.contract(amount, axis=None)[source]

Resize an H5Array by removing amount elements along the selected axis.

Raises:

TypeError – if the H5Array does not wrap a chunked Dataset.

Return type:

None

Parameters:
H5Array.copy()[source]
Return type:

ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]

H5Array.expand(amount, axis=None)[source]

Resize an H5Array by adding amount elements along the selected axis.

Raises:

TypeError – if the H5Array does not wrap a chunked Dataset.

Return type:

None

Parameters:
H5Array.iter_chunks(keepdims=False)[source]
Return type:

ChunkIterator

Parameters:

keepdims (bool) –

H5Array.iter_chunks_with(other, keepdims=False)[source]
Return type:

PairedChunkIterator

Parameters:
H5Array.maptype(otype)[source]

Cast an H5Array to any object type. This extends H5Array.astype() to any type <T>, where it is required that an object <T> can be constructed as T(v) for any value <v> in the dataset.

Return type:

H5Array[Any]

Parameters:

otype (type[Any]) –

H5Array.max(axis=None)[source]
Return type:

Union[TypeVar(_T, bound= generic, covariant=True), ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]]

Parameters:

axis (int | tuple[int, ...] | None) –

H5Array.mean(axis=None)[source]
Return type:

Union[Any, ndarray[Any, dtype[Any]]]

Parameters:

axis (int | tuple[int, ...] | None) –

H5Array.min(axis=None)[source]
Return type:

Union[TypeVar(_T, bound= generic, covariant=True), ndarray[Any, dtype[TypeVar(_T, bound= generic, covariant=True)]]]

Parameters:

axis (int | tuple[int, ...] | None) –

H5Array.read_direct(dest, source_sel, dest_sel)[source]
Return type:

None

Parameters: