This modules implements data proxies as specializations of the
This module implements a
specialization for HDF5 data.
- class Hdf5DataProxy(obj: Dataset, *, resolve_as_dask: bool = False)#
The Hdf5DataProxy is a placeholder for a
It saves the filename and dataset name needed to later load the dataset. Additionaly, it caches some values that give information on the shape and dtype of the dataset, thus further delaying the load to the time the actual data is required.
Depending on the type that this proxy is resolved as via the
resolve()method, the corresponding
h5py.Fileobject needs to stay open and in memory; it is closed upon garbage-collection of this object.
- __init__(obj: Dataset, *, resolve_as_dask: bool = False)#
Initializes a proxy object for a
- resolve(*, astype: Optional[type] = None)#
Resolve the data of this proxy by opening the hdf5 file and loading the dataset into a
numpy.ndarrayor a type specified by the
astype (type, optional) – As which type to return the data from the dataset this object is proxy for. If None, will return as
h5py.Fileobject stays in memory until the proxy is deleted. Note that if
resolve_as_daskwas specified during proxy initialization, the data will be loaded as
astypeis not specified in this call!
the resolved data.
- Return type
type specified by
- _open_h5file() File #
Opens the associated HDF5 file and stores it in
_h5filesin order to keep it in scope. These file objects are only closed upon deletion of this proxy object!
The newly opened HDF5 file
- Return type
Make sure all potentially still open h5py.File objects are closed
- property shape#
The cached shape of the dataset, accessible without resolving
- property dtype#
The cached dtype of the dataset, accessible without resolving
- property ndim#
The cached ndim of the dataset, accessible without resolving
- property size#
The cached size of the dataset, accessible without resolving
- property chunks#
The cached chunks of the dataset, accessible without resolving
- _abc_impl = <_abc_data object>#
These are empty by default and may also be overwritten in the object.
The tags describing this proxy object