spine.io.parse.hdf5.tensor

Lightweight parsers for cached HDF5 tensor products.

Classes

HDF5ClusterTensorParser(dtype[, index_cols, ...])

Build a cluster-label ParserTensor from cached HDF5 tensors.

HDF5FeatureTensorParser(dtype[, ...])

Build a feature-only ParserTensor from a cached HDF5 array.

HDF5TensorParser(dtype[, has_batch_col, ...])

Build a sparse-tensor ParserTensor from a cached HDF5 tensor.

class spine.io.parse.hdf5.tensor.HDF5TensorParser(dtype: str, has_batch_col: bool = True, coord_start_col: int = 1, feature_start_col: int = 4, meta_event: str | None = None, feature_cols: list[int] | tuple[int, ...] | ndarray | None = None, **kwargs: Any)[source]

Build a sparse-tensor ParserTensor from a cached HDF5 tensor.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into a sparse-tensor parser payload.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(tensor_event[, meta_event])

Split one cached tensor into coordinates, features, and metadata.

name: ClassVar[str | None] = 'tensor'
returns: ClassVar[str | None] = 'tensor'
process(tensor_event: ndarray, meta_event: ImageMeta3D | None = None) ParserTensor[source]

Split one cached tensor into coordinates, features, and metadata.

class spine.io.parse.hdf5.tensor.HDF5ClusterTensorParser(dtype: str, index_cols: list[int] | tuple[int, ...] | ndarray | None = None, sum_cols: list[int] | tuple[int, ...] | ndarray | None = None, avg_cols: list[int] | tuple[int, ...] | ndarray | None = None, prec_col: int | None = None, precedence: list[int] | tuple[int, ...] | ndarray | None = None, remove_duplicates: bool = True, **kwargs: Any)[source]

Build a cluster-label ParserTensor from cached HDF5 tensors.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into a sparse-tensor parser payload.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(tensor_event[, meta_event])

Split one cached cluster tensor and restore cluster parser semantics.

name: ClassVar[str | None] = 'cluster_tensor'
process(tensor_event: ndarray, meta_event: ImageMeta3D | None = None) ParserTensor[source]

Split one cached cluster tensor and restore cluster parser semantics.

class spine.io.parse.hdf5.tensor.HDF5FeatureTensorParser(dtype: str, feature_cols: list[int] | tuple[int, ...] | ndarray | None = None, remove_duplicates: bool = False, overlay_reference: str | None = None, **kwargs: Any)[source]

Build a feature-only ParserTensor from a cached HDF5 array.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into a feature-only parser tensor.

get_input_data(trees)

Build the parser-call input dictionary from loaded tree products.

process(tensor_event)

Cast one cached per-entry array into a feature-only parser tensor.

name: ClassVar[str | None] = 'feature_tensor'
returns: ClassVar[str | None] = 'tensor'
process(tensor_event: ndarray) ParserTensor[source]

Cast one cached per-entry array into a feature-only parser tensor.

Parameters:

tensor_event (np.ndarray) – Cached feature array for one event entry.

Returns:

Feature-only parser tensor with features cast to the parser float dtype.

Return type:

ParserTensor