pyfli.io.spad_hdf5#
Discover and read SPAD data from arbitrary HDF5 structures.
This module belongs to pyfli.io and provides structure-aware HDF5 discovery
without requiring detector-specific group or dataset names. Explicit metadata and
user hints take priority over structural inference, while ambiguous layouts are
reported instead of selected silently.
Functions
|
Find an HDF5 attribute by normalized case-insensitive name. |
|
Build candidate split-gate layouts from repeated 2D numeric datasets. |
|
Build candidate stacked-cube layouts from 3D numeric datasets. |
|
Return a compact human-readable HDF5 candidate description. |
|
Return whether a candidate has enough information for deterministic loading. |
|
Collect metadata for every non-compound numeric dataset in an HDF5 file. |
|
Extract numeric tokens from an HDF5 path in left-to-right order. |
|
Infer gate ordering from a shared scalar numeric dataset attribute. |
|
Infer ordering from the numeric path component that varies across datasets. |
|
Infer deterministic gate ordering using metadata first and path numbers second. |
|
Infer a stacked cube's temporal axis using metadata before shape clues. |
|
Return True for non-compound numeric datasets suitable for SPAD image data. |
|
Return a small semantic bonus without making names part of the schema. |
|
Normalize an attribute or axis label for semantic comparison. |
|
Normalize an HDF5 object path to a leading-slash representation. |
|
Replace numeric tokens in a path so repeated datasets group together. |
|
Convert a scalar numeric HDF5 attribute to float, otherwise return None. |
|
Return the normalized HDF5 parent path. |
|
Parse a common HDF5 axis-order attribute into normalized axis tokens. |
|
Convert HDF5 attribute values to lightweight Python representations. |
|
Read an ordered set of 2D gate datasets and stack them into (H, W, T). |
|
Read one stacked 3D dataset and move its temporal axis to the last dimension. |
|
Select one deterministic HDF5 layout, rejecting missing or ambiguous discovery. |
|
Inspect an HDF5 file and return ranked candidate SPAD layouts. |
|
Discover and normalize SPAD image data from an HDF5 file into (H, W, T). |
Classes
|
Describe one candidate SPAD layout discovered inside an HDF5 file. |
|
Describe one numeric HDF5 dataset without loading its full contents. |
|
Store normalized SPAD HDF5 data and discovery metadata. |
- class HDF5DatasetInfo(path, shape, dtype, attributes, dimension_labels)[source]#
Bases:
objectDescribe one numeric HDF5 dataset without loading its full contents.
- Parameters:
- class HDF5Candidate(kind, dataset_paths, score, spatial_shape, time_axis, gate_values, ordering_source, original_shape)[source]#
Bases:
objectDescribe one candidate SPAD layout discovered inside an HDF5 file.
- Parameters:
- class SpadHDF5ReadResult(data, candidate, source_path)[source]#
Bases:
objectStore normalized SPAD HDF5 data and discovery metadata.
- Parameters:
data (ndarray)
candidate (HDF5Candidate)
source_path (str)
- candidate: HDF5Candidate#
- inspect_spad_hdf5(fname, dataset_path=None, time_axis=None, gate_group_path=None, gate_order_attribute=None, gate_prefix=None)[source]#
Inspect an HDF5 file and return ranked candidate SPAD layouts.
- Parameters:
fname (
str) – HDF5 file to inspect.dataset_path (
str | None) – Explicit stacked 3D dataset path.time_axis (
int | None) – Explicit temporal axis for a stacked 3D dataset.gate_group_path (
str | None) – Explicit group path containing split 2D gate datasets.gate_order_attribute (
str | None) – Dataset attribute used to order split gates.gate_prefix (
str | None) – Optional dataset-name prefix used as a backwards-compatible discovery hint.
- Returns:
Candidate layouts sorted from highest to lowest discovery score.
- Return type:
list[HDF5Candidate]
- read_spad_hdf5(fname, dataset_path=None, time_axis=None, gate_group_path=None, gate_order_attribute=None, gate_prefix=None)[source]#
Discover and normalize SPAD image data from an HDF5 file into (H, W, T).
- Parameters:
fname (
str) – HDF5 file to read.dataset_path (
str | None) – Explicit stacked 3D dataset path when automatic discovery is ambiguous.time_axis (
int | None) – Explicit temporal axis for a stacked 3D dataset.gate_group_path (
str | None) – Explicit group path containing split 2D gate datasets.gate_order_attribute (
str | None) – Dataset attribute used to order split gate datasets.gate_prefix (
str | None) – Optional dataset-name prefix used as a backwards-compatible discovery hint.
- Returns:
Normalized HDF5 data cube and discovery metadata.
- Return type: