HDF5 Reader

class gpype.backend.sources.hdf5_reader.HDF5Reader[source]

Bases: RecordingReader

Replays a plain HDF5 (.h5) recording as if it were a live source.

Reads back what HDF5Writer writes – sampling rate, channel labels and roles from the gpype_meta document, falling back to native HDF5 attributes and then to the recorded time column when metadata is absent, and to the caller’s own sampling_rate when none of those can supply one – which is what lets this read a bare third-party HDF5 dataset as long as the rate is given. Markers, gaps and trust come back from gpype_meta too.

__init__(file_name, sampling_rate=None, frame_size=1, speed=1.0, loop=False, mode='realtime', variable_name='data', has_time_row=True, edge_id=None, **kwargs)[source]

Initialize the reader core.

Parameters:
  • file_name (str) – Path to the .h5 recording.

  • sampling_rate (Optional[float]) – The recording’s rate, if the file cannot say; one given must agree with a rate it records.

  • frame_size (int) – Samples emitted per cycle. In batch mode the frame is the whole recording.

  • speed (float) – Replay speed relative to real time.

  • loop (bool) – Start again at the end of the file.

  • mode (str) – realtime or batch.

  • variable_name (str) – Name of the dataset HDF5Writer wrote the recording under.

  • has_time_row (bool) – Whether the dataset’s first row is a time axis rather than a signal channel.

  • edge_id (Optional[str]) – Which edge runs this node, matched against the edge process’s –edge-id. None, the default, is every edge; ignored when the pipeline is not distributed.

  • **kwargs – Additional arguments for the parent reader.

Raises:
  • ImportError – If h5py is not installed.

  • ValueError – If no usable rate or dataset can be found, or a sampling_rate, channel_count or batch frame_size given by hand disagrees with the file.