HDF5¶
Interfaces for HDF5 Datasets
- class H5ArrayPath(file: Path | str, path: str)[source]¶
Location specifier for arrays within an HDF5 file
Create new instance of H5ArrayPath(file, path)
- class H5Proxy(file: Path | str, path: str)[source]¶
Proxy class to mimic numpy-like array behavior with an HDF5 array
The attribute and item access methods only open the file for the duration of the method, making it less perilous to share this object between threads and processes.
This class attempts to be a passthrough class to a
h5py.Datasetobject, including its attributes and item getters/setters.When using read-only methods, no locking is attempted (beyond the HDF5 defaults), but when using the write methods (setting an array value), try and use the
lockingmethods ofh5py.File.- Parameters:
file (pathlib.Path | str) – Location of hdf5 file on filesystem
path (str) – Path to array within hdf5 file
- classmethod from_h5array(h5array: H5ArrayPath) H5Proxy[source]¶
Instantiate using
H5ArrayPath
- open(mode: str = 'r') Dataset[source]¶
Return the opened
h5py.DatasetobjectYou must remember to close the associated file with
close()
- class H5Interface(shape: Tuple[int, ...] | Any, dtype: str | type | Any | generic)[source]¶
Interface for Arrays stored as datasets within an HDF5 file.
Takes a
H5ArrayPathspecifier to select ah5py.Datasetfrom ah5py.Fileand returns aH5Proxyclass that acts like a passthrough numpy-like interface to the dataset.- classmethod check(array: H5ArrayPath | Tuple[Path | str, str]) bool[source]¶
Check that the given array is a
H5ArrayPathor something that resembles one.
- before_validation(array: Any) NDArrayType[source]¶
Create an
H5Proxyto use throughout validation