spine.io.parse.larcv.sparse

Module that contains all parsers related to LArCV sparse data.

Contains the following parsers: - LArCVSparse2DParser - LArCVSparse3DParser - LArCVSparse3DAggregateParser - LArCVSparse3DChargeRescaledParser - LArCVSparse3DGhostParser

Classes

LArCVSparse2DParser(dtype, projection_id[, ...])

Class that retrieves and parses a 2D sparse tensor.

LArCVSparse3DAggregateParser(dtype, aggr, ...)

Class that aggregates features from multiple sparse tensors

LArCVSparse3DChargeRescaledParser(dtype[, ...])

Class that convert a tensor containing semantics to binary ghost labels.

LArCVSparse3DGhostParser(dtype[, ...])

Class that convert a tensor containing semantics to binary ghost labels.

LArCVSparse3DParser(dtype[, sparse_event, ...])

Class that retrieves and parses a 3D sparse tensor.

class spine.io.parse.larcv.sparse.LArCVSparse2DParser(dtype: str, projection_id: int, sparse_event: Any | None = None, sparse_event_list: list[Any] | None = None)[source]

Class that retrieves and parses a 2D sparse tensor.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process([sparse_event, sparse_event_list])

Fetches one or a list of tensors, concatenate their feature vectors.

name: ClassVar[str | None] = 'parse_sparse2d'
returns: ClassVar[str | None] = 'tensor'
process(sparse_event: Any | None = None, sparse_event_list: list[Any] | None = None) ParserTensor[source]

Fetches one or a list of tensors, concatenate their feature vectors.

Parameters:
  • sparse_event (larcv.EventSparseTensor2D, optional) – Sparse tensor to get the voxel/features from

  • sparse_event_list (List[larcv.EventSparseTensor2D], optional) – List of sparse tensors to get the voxel/features from

Returns:

coordsnp.ndarray

(N, 2) array of [x, y] coordinates

featuresnp.ndarray

(N, C) array of [pixel value 0, pixel value 1, …]

metaMeta

Metadata of the parsed images

Return type:

ParserTensor

class spine.io.parse.larcv.sparse.LArCVSparse3DParser(dtype: str, sparse_event: Any | None = None, sparse_event_list: list[Any] | None = None, num_features: int | None = None, hit_keys: list[int] | None = None, nhits_idx: int | None = None, feature_only: bool = False, lexsort: bool = False, index_cols: ndarray | None = None, sum_cols: ndarray | None = None, avg_cols: ndarray | None = None, prec_col: int | None = None, precedence: ndarray | list[int] | tuple[int, ...] = (1, 2, 0, 3, 4, 6, 5), overlay_reference: str | None = None)[source]

Class that retrieves and parses a 3D sparse tensor.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process([sparse_event, sparse_event_list])

Fetches one or a list of tensors, concatenate their feature vectors.

name: ClassVar[str | None] = 'sparse3d'
returns: ClassVar[str | None] = 'tensor'
process(sparse_event: Any | None = None, sparse_event_list: list[Any] | None = None) ParserTensor[source]

Fetches one or a list of tensors, concatenate their feature vectors.

Parameters:
  • sparse_event (larcv.EventSparseTensor3D, optional) – Sparse tensor to get the voxel/features from

  • sparse_event_list (List[larcv.EventSparseTensor3D], optional) – List of sparse tensors to get the voxel/features from

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, C) array of [pixel value 0, pixel value 1, …]

metaMeta

Metadata of the parsed images

Return type:

ParserTensor

class spine.io.parse.larcv.sparse.LArCVSparse3DAggregateParser(dtype: str, aggr: str, **kwargs: Any)[source]

Class that aggregates features from multiple sparse tensors

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process([sparse_event, sparse_event_list])

Fetches one or a list of tensors, concatenate their feature vectors.

process_aggr(sparse_event_list)

Fetches a list of tensors, aggregate their feature vectors.

name: ClassVar[str | None] = 'sparse3d_aggr'
process_aggr(sparse_event_list: list[Any]) ParserTensor[source]

Fetches a list of tensors, aggregate their feature vectors.

Parameters:

sparse_event_list (List[larcv.EventSparseTensor3D]) – Sparse tensor list to get the voxel/features from

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 1) array of aggregated features

metaMeta

Metadata of the parsed image

Return type:

ParserTensor

class spine.io.parse.larcv.sparse.LArCVSparse3DChargeRescaledParser(dtype: str, collection_only: bool = False, collection_id: int = 2, **kwargs: Any)[source]

Class that convert a tensor containing semantics to binary ghost labels.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process([sparse_event, sparse_event_list])

Fetches one or a list of tensors, concatenate their feature vectors.

process_rescale(sparse_event_list)

Fetches one or a list of tensors, concatenate their feature vectors.

name: ClassVar[str | None] = 'parse_sparse3d_rescale_charge'
aliases: ClassVar[tuple[str, ...]] = ('parse_sparse3d_charge_rescaled',)
process_rescale(sparse_event_list: list[Any]) ParserTensor[source]

Fetches one or a list of tensors, concatenate their feature vectors.

Parameters:

sparse_event_list (List[larcv.EventSparseTensor3D]) – (7) List of sparse tensors used to compute the rescaled charge - Charge value of each of the contributing planes (3) - Index of the plane hit contributing to the space point (3) - Semantic labels (1)

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 1) array of rescaled charge values

metaMeta

Metadata of the parsed image

Return type:

ParserTensor

class spine.io.parse.larcv.sparse.LArCVSparse3DGhostParser(dtype: str, sparse_event: Any | None = None, sparse_event_list: list[Any] | None = None, num_features: int | None = None, hit_keys: list[int] | None = None, nhits_idx: int | None = None, feature_only: bool = False, lexsort: bool = False, index_cols: ndarray | None = None, sum_cols: ndarray | None = None, avg_cols: ndarray | None = None, prec_col: int | None = None, precedence: ndarray | list[int] | tuple[int, ...] = (1, 2, 0, 3, 4, 6, 5), overlay_reference: str | None = None)[source]

Class that convert a tensor containing semantics to binary ghost labels.

Attributes:
overlay

Methods

__call__(trees)

Parse one entry.

get_input_data(trees)

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

process([sparse_event, sparse_event_list])

Fetches one or a list of tensors, concatenate their feature vectors.

process_ghost(sparse_event)

Fetches one or a list of tensors, concatenate their feature vectors.

name: ClassVar[str | None] = 'sparse3d_ghost'
process_ghost(sparse_event: Any) ParserTensor[source]

Fetches one or a list of tensors, concatenate their feature vectors.

Parameters:

sparse_event (larcv.EventSparseTensor3D) – Sparse tensor to get the semantic labels

Returns:

coordsnp.ndarray

(N, 3) array of [x, y, z] coordinates

featuresnp.ndarray

(N, 1) array of ghost labels (1 for ghosts, 0 otherwise)

metaMeta

Metadata of the parsed image

Return type:

ParserTensor