ssapy_toolkit.io.hdf5_utils

Functions

append_h5(filename, key, append_data)

Append rows along axis 0.

combine_h5(filename, files[, verbose, overwrite])

Merge datasets from multiple HDF5 files into filename without clobbering existing keys.

h5_key_exists(filename, key)

True if key exists anywhere in the file (supports nested paths like 'a/b/c').

h5_keys(file_path)

List full dataset paths in an HDF5 file.

h5_root_keys(file_path)

List top-level members.

overwrite_h5(filename, key, new_data)

Overwrite (or create) dataset at key.

read_h5(filename, key)

Load data from an HDF5 file.

read_h5_all(file_path)

Flatten all datasets into a dict keyed by their full HDF5 paths.

read_h5_to_dict(file_path)

save_h5(filename, key, data)

Create a dataset at key.

verify_h5_file(filename[, mode, verbose])

Verify an HDF5 file with selectable depth of checking.

ssapy_toolkit.io.hdf5_utils.append_h5(filename: str, key: str, append_data) None[source]

Append rows along axis 0. If dataset doesn’t exist, create it. Note: append_data must be broadcastable to the dataset shape except on axis 0.

ssapy_toolkit.io.hdf5_utils.combine_h5(filename: str, files: list, verbose: bool = False, overwrite: bool = False) None[source]

Merge datasets from multiple HDF5 files into filename without clobbering existing keys.

ssapy_toolkit.io.hdf5_utils.h5_key_exists(filename: str, key: str) bool[source]

True if key exists anywhere in the file (supports nested paths like ‘a/b/c’).

ssapy_toolkit.io.hdf5_utils.h5_keys(file_path: str) list[source]

List full dataset paths in an HDF5 file.

ssapy_toolkit.io.hdf5_utils.h5_root_keys(file_path: str) list[source]

List top-level members.

ssapy_toolkit.io.hdf5_utils.overwrite_h5(filename: str, key: str, new_data) None[source]

Overwrite (or create) dataset at key.

ssapy_toolkit.io.hdf5_utils.read_h5(filename: str, key: str)[source]

Load data from an HDF5 file. Returns np.ndarray (or scalar) or None if missing.

ssapy_toolkit.io.hdf5_utils.read_h5_all(file_path: str) dict[source]

Flatten all datasets into a dict keyed by their full HDF5 paths.

ssapy_toolkit.io.hdf5_utils.read_h5_to_dict(file_path: str) dict[source]
ssapy_toolkit.io.hdf5_utils.save_h5(filename: str, key: str, data) None[source]

Create a dataset at key. Creates parent groups if needed. Fails if dataset exists.

ssapy_toolkit.io.hdf5_utils.verify_h5_file(filename: str, mode: str = 'structure', verbose: bool = False) bool[source]

Verify an HDF5 file with selectable depth of checking.

Modes

open

Only verify the file exists and can be opened. Fastest, but weakest check.

structure

Verify the file opens and every object in the hierarchy can be accessed. Fast and usually sufficient for structural sanity checking.

full

Verify the file opens and every dataset can be fully read. Slowest, but strongest check.

param filename:

Path to the HDF5 file.

type filename:

str

param mode:

One of {“open”, “structure”, “full”}.

type mode:

str

param verbose:

If True, print any errors encountered.

type verbose:

bool

returns:

True if the file passes the selected verification mode, otherwise False.

rtype:

bool