spine.io.parse.hdf5.index

Lightweight parsers for cached HDF5 index products.

Classes

HDF5EdgeIndexParser(dtype, index_event, ...)

Build an edge-index ParserEdgeIndex from cached HDF5 data.

HDF5IndexListParser(dtype, index_event, ...)

Build an index-list ParserIndexList from cached HDF5 data.

HDF5IndexParser(dtype, index_event, count_event)

Build a flat ParserIndex from cached HDF5 data.

class spine.io.parse.hdf5.index.HDF5IndexParser(dtype: str, index_event: str, count_event: str)[source]

Build a flat ParserIndex from cached HDF5 data.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into a flat index parser tensor.

get_input_data(trees)

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

process(index_event, count_event)

Normalize one cached flat index for collation into an IndexBatch.

name: ClassVar[str | None] = 'index'
returns: ClassVar[str | None] = 'tensor'
process(index_event: ndarray, count_event: ndarray) ParserIndex[source]

Normalize one cached flat index for collation into an IndexBatch.

Parameters:
  • index_event (np.ndarray) – Cached flat index array for one event entry.

  • count_event (np.ndarray) – Cached tensor or scalar count used to infer the offset span of the indexed parent entry.

Returns:

Parser index containing one normalized 1D index array.

Return type:

ParserIndex

class spine.io.parse.hdf5.index.HDF5IndexListParser(dtype: str, index_event: str, count_event: str)[source]

Build an index-list ParserIndexList from cached HDF5 data.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into a jagged index-list parser tensor.

get_input_data(trees)

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

process(index_event, count_event)

Normalize cached index lists for collation into an IndexBatch.

name: ClassVar[str | None] = 'index_list'
returns: ClassVar[str | None] = 'tensor'
process(index_event: ndarray, count_event: ndarray) ParserIndexList[source]

Normalize cached index lists for collation into an IndexBatch.

Parameters:
  • index_event (np.ndarray) – Object array or nested array containing one index list per element.

  • count_event (np.ndarray) – Cached tensor or scalar count used to infer the offset span of the indexed parent entry.

Returns:

Parser index list containing normalized 1D index arrays.

Return type:

ParserIndexList

class spine.io.parse.hdf5.index.HDF5EdgeIndexParser(dtype: str, index_event: str, count_event: str)[source]

Build an edge-index ParserEdgeIndex from cached HDF5 data.

Attributes:
overlay

Methods

__call__(trees)

Parse one cached entry into an edge-index parser tensor.

get_input_data(trees)

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

process(index_event, count_event)

Normalize cached edge indexes for collation into an EdgeIndexBatch.

name: ClassVar[str | None] = 'edge_index'
returns: ClassVar[str | None] = 'tensor'
process(index_event: ndarray, count_event: ndarray) ParserEdgeIndex[source]

Normalize cached edge indexes for collation into an EdgeIndexBatch.

Parameters:
  • index_event (np.ndarray) – Cached edge-index array with shape (2, E) or (E, 2).

  • count_event (np.ndarray) – Cached tensor or scalar count used to infer the node span of the indexed parent entry.

Returns:

Parser edge index containing a normalized (2, E) array.

Return type:

ParserEdgeIndex