HDF5 recordings#
Configure writing with dendra.models.callbacks.Recorder.set_hdf5() and
close the recorder before opening the file. H5Reader provides lazy Dask
arrays; compute values while the reader remains open:
from dendra.data import H5Reader
with H5Reader("recording.h5") as reader:
voltage = reader["v"][0][:].compute()
The first index selects a recorded variable, the second selects its run, and the final index slices the concatenated time axis. See Recording and online analysis for writing and cadence.
- class H5Reader(path)[source]#
Read a Recorder HDF5 file as lazily concatenated Dask arrays.
- Parameters:
path (str or path-like) – Existing HDF5 recording file. Finish and close the recorder before reading.
Notes
Use as a context manager.
reader[variable][run_index]selects a run; indexing that run returns a lazy Dask array. Compute the array while the reader is open. Access through a closed reader raisesValueError.- property closed#
Whether the underlying HDF5 file handle is closed.
- class H5Var(group, reader, name)[source]#
Variable handle returned by
H5Reader.Index with a non-negative integer to select
run_0,run_1, and so on. The parent reader must remain open while reading a run.
- class H5Rec(group, reader, name, run)[source]#
One run returned by indexing an
H5Varhandle.- data#
Recording chunks concatenated along the leading time axis in natural chunk order. Other axes preserve the Recorder’s selected layout.
- Type:
dask.array.Array
Notes
Indexing this handle returns a lazy slice of
data. Compute it before closing the parentH5Reader.