zkit.io.base
Base HDF5 utilities for zkit.
- zkit.io.base.list_datasets(path)
List top-level datasets inside an HDF5 file.
- Parameters:
path (str | Path)
- Return type:
List[str]
- zkit.io.base.dataset_shape(path, name)
Return the shape of a top-level dataset.
- Parameters:
path (str | Path)
name (str)
- Return type:
Tuple[int, …]
- zkit.io.base.read_dataset(path, name, *, sl=None)
Read a top-level dataset as a NumPy array.
- Parameters:
path (str | Path)
name (str)
sl (slice | None)
- Return type:
ndarray
- zkit.io.base.detect_dimension(path)
Infer the spatial dimension (1, 2, or 3) of a TDSEZ HDF5 output file.
Works for every TDSEZ output flavour without needing the input file:
td/TimeEvolutionData_*.h5-> dipole column width (4/7/10).static/EigenData_*.h5->run_metadataDimension
attribute, falling back to the number of
knots_*datasets. *td/wfs_*.h5-> number ofknots_*datasets.- Raises:
ValueError – If no dimension signal can be found in the file.
- Parameters:
path (str | Path)
- Return type:
int