spine.vis.lite

Draw lite data structures with compact geometric surrogates.

It represents: - Lite tracks as simple lines - Lite showers as simple cones - Lite interactions as collections of lines and cones

Functions

em_cone_trace(start_point, direction, energy)

Generates a cone trace representing an electromagnetic shower.

legend_trace([color, cmin, cmax, ...])

Generates a dummy trace to show in the legend.

scatter_lite(objects, **kwargs)

Produces plotly traces for Lite objects.

scatter_lite_interactions(interactions[, ...])

Produces plotly traces for Lite interactions.

scatter_lite_particles(particles[, color, ...])

Produces plotly traces for Lite particles.

track_line_trace(start_point, end_point[, ...])

Generates a line trace representing a track between two points.

spine.vis.lite.scatter_lite(objects: list, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Produces plotly traces for Lite objects.

Parameters:
  • objects (List[spine.data.out.OutBase]) – List of lite objects to visualize

  • **kwargs (dict, optional) – Additional parameters to pass to the plotly trace objects

Returns:

List of plotly trace objects representing the Lite objects

Return type:

List[object]

spine.vis.lite.scatter_lite_interactions(interactions: list, color: ColorInput = None, hovertext: HoverTextInput = None, name: str | list[str] | None = None, cmin: float | None = None, cmax: float | None = None, shared_legend: bool = True, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Produces plotly traces for Lite interactions.

Parameters:
  • interactions (List[spine.data.out.InteractionLite]) – List of lite interactions to visualize

  • color (Union[str, float], optional) – Color of the interaction trace

  • hovertext (Union[int, str, np.ndarray], optional) – Text associated with the interaction trace

  • name (Union[str, List[str]], optional) – Name of the interaction or of each interaction

  • cmin (float, optional) – Minimum value along the color scale

  • cmax (float, optional) – Maximum value along the color scale

  • shared_legend (bool, default True) – If True put all interaction traces under a single shared legend

  • **kwargs (dict, optional) – Additional parameters to pass to the plot

spine.vis.lite.scatter_lite_particles(particles: list, color: ColorInput = None, hovertext: HoverTextInput = None, showscale: bool = False, linewidth: float = 5.0, cone_num_samples: int = 10, name: str | list[str] | None = None, cmin: float | None = None, cmax: float | None = None, colorscale: str | list | None = None, legendgroup: str | None = None, showlegend: bool = True, shared_legend: bool = True, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Produces plotly traces for Lite particles.

Parameters:
  • particles (List[spine.data.out.ParticleBase]) – List of lite particles to visualize

  • color (Union[str, float], optional) – Color of the particle trace

  • hovertext (Union[int, str, np.ndarray], optional) – Text associated with the particle trace

  • showscale (bool, default False) – If True, show the colorscale of the plotly.graph_objs.Mesh3d

  • cone_num_samples (int, default 10) – Number of samples to use for the cone mesh

  • name (Union[str, List[str]], optional) – Name of the particle or of each particle

  • cmin (float, optional) – Minimum value along the color scale

  • cmax (float, optional) – Maximum value along the color scale

  • colorscale (List[Union[str, float]], optional) – Colorscale of the particle trace

  • legendgroup (str, optional) – Legend group name for the trace

  • showlegend (bool, optional) – Whether to show the legend for the trace

  • shared_legend (bool, default True) – If True put all particle traces under a single shared legend

  • **kwargs (dict, optional) – Additional parameters to pass to the plotly trace objects

Returns:

List of plotly trace objects representing the Lite particle

Return type:

List[object]

spine.vis.lite.track_line_trace(start_point: ndarray, end_point: ndarray, line: dict[str, Any] | None = None, color: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, hovertext: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, colorscale: str | list | None = None, cmin: float | None = None, cmax: float | None = None, linewidth: float = 5.0, **kwargs: Any) plotly.graph_objs.Scatter3d[source]

Generates a line trace representing a track between two points.

Parameters:
  • start_point (np.ndarray) – (3,) Array representing the starting point of the track.

  • end_point (np.ndarray) – (3,) Array representing the ending point of the track.

  • line (dict, optional) – Dictionary defining line properties (e.g., width, dash style)

  • color (Union[str, int, float, Sequence], optional) – Color of the line trace. Can be one shared scalar value or one value per line endpoint.

  • hovertext (Union[int, float, str, Sequence], optional) – Text associated with the line trace. Can be one shared label or one label per line endpoint.

  • colorscale (List[Union[str, float]], optional) – Colorscale of the line trace

  • cmin (float, optional) – Minimum value along the color scale

  • cmax (float, optional) – Maximum value along the color scale

  • linewidth (float, default 2.0) – Width of the line trace

  • **kwargs (dict, optional) – Additional parameters to pass to the plot

spine.vis.lite.em_cone_trace(start_point: ndarray, direction: ndarray, energy: float, num_samples: int = 10, color: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, intensity: bool | int | float | generic | Sequence[bool | int | float | generic] | ndarray | None = None, hovertext: bool | int | float | generic | str | Sequence[bool | int | float | generic | str] | ndarray | None = None, showscale: bool = False, **kwargs: Any) plotly.graph_objs.Mesh3d[source]

Generates a cone trace representing an electromagnetic shower.

Parameters:
  • start (np.ndarray) – (3,) Array representing the starting point of the shower.

  • direction (np.ndarray) – (3,) Array representing the direction vector of the shower.

  • energy (float) – Energy of the shower in MeV.

  • num_samples (int, default 10) – Number of samples to use for the cone mesh.

  • color (Union[str, int, float, Sequence], optional) – Color of the cone trace. Must be provided as one scalar value.

  • intensity (Union[int, float, Sequence], optional) – Intensity of the cone colors. Can be a single numeric value or a per-vertex sequence.

  • hovertext (Union[int, float, str, Sequence], optional) – Text associated with the cone trace. Can be a scalar label or a per-vertex sequence of labels.

  • showscale (bool, default False) – If True, show the colorscale of the plotly.graph_objs.Mesh3d

  • **kwargs (dict, optional) – Additional parameters to pass to the plotly trace object.

Returns:

Plotly Mesh3d trace representing the electromagnetic shower cone.

Return type:

object

spine.vis.lite.legend_trace(color: bool | int | float | generic | str | None = None, cmin: float | None = None, cmax: float | None = None, colorscale: str | list | None = None, legendgroup: str | None = None, name: str | None = None) plotly.graph_objs.Scatter3d[source]

Generates a dummy trace to show in the legend.

Parameters:
  • color (Union[str, float]) – Color of the legend trace

  • cmin (float, optional) – Minimum value along the color scale

  • cmax (float, optional) – Maximum value along the color scale

  • colorscale (List[Union[str, float]], optional) – Colorscale of the legend trace

  • **kwargs (dict, optional) – Additional parameters to pass to the plotly trace object

Returns:

Plotly Scatter3d trace representing the legend entry.

Return type:

object