HDF5 Writer

class gpype.backend.sinks.hdf5_writer.HDF5Writer[source]

Bases: FileWriter

Plain HDF5 (.h5) file writer for real-time data logging.

Writes multi-channel data with a time column plus one column per channel under variable_name, alongside a gpype_meta JSON document and plain HDF5 attributes describing the rate, labels and roles – so both a g.Pype HDF5Reader and a bare h5py script can make sense of the file.

Unlike MatWriter, this is an ordinary HDF5 container with no userblock and no MATLAB conventions – for a consumer that wants HDF5 without MATLAB’s baggage, or a language whose HDF5 bindings do not speak MATLAB’s dialect.

__init__(file_name, variable_name='data', edge_id=None, **kwargs)[source]

Initialize the HDF5 writer core.

Parameters:
  • file_name (str) – Base filename for the .h5 output. A timestamp will be automatically appended.

  • variable_name (str) – Name of the dataset the recording is written under.

  • 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 passed to parent FileWriter.

property file_extension

Return the file extension for HDF5 files.

A single extension only: FileWriter._check_extension compares against one string, and widening that base contract to accept both .h5 and .hdf5 is out of scope here.

Returns:

The HDF5 file extension ‘.h5’.