spine.vis.geo

Detector-geometry drawers and helpers.

Classes

GeoDrawer([geo, detector_coords])

Handles drawing all things related to the detector geometry.

class spine.vis.geo.GeoDrawer(geo: Geometry | None = None, detector_coords: bool = True)[source]

Handles drawing all things related to the detector geometry.

This class is loads a Geometry object once from a geometry file and uses it to represent all things related to the detector geometry: - TPC boundaries - Optical detectors - CRT detectors

geo

The underlying detector geometry

Type:

Geometry

detector_coords

Whether or not to use detector coordinates (True) or pixel indices

Type:

bool

Methods

crt_traces([meta, draw_faces, ...])

Function which produces a list of traces which represent the optical detectors in a 3D event display.

optical_traces([meta, shared_legend, ...])

Function which produces a list of traces which represent the optical detectors in a 3D event display.

show([meta, tpc, optical, crt])

Displays the detector geometry in a 3D plotly figure.

tpc_traces([meta, draw_faces, ...])

Function which produces a list of traces which represent the TPCs in a 3D event display.

traces([meta, tpc, optical, crt])

Returns all traces associated with the detector geometry.

show(meta: ImageMeta3D | None = None, tpc: bool = True, optical: bool = True, crt: bool = True, **kwargs: Any) None[source]

Displays the detector geometry in a 3D plotly figure.

Parameters:
  • meta (Meta, optional) – Metadata information (only needed if pixel_coordinates is True)

  • tpc (bool, default True) – Whether or not to include TPC traces

  • optical (bool, default True) – Whether or not to include optical detector traces

  • crt (bool, default True) – Whether or not to include CRT detector traces

  • **kwargs (dict, optional) – Additional arguments to pass to layout3d

traces(meta: Meta | None = None, tpc: bool = True, optical: bool = True, crt: bool = True) list[go.Scatter3d | go.Mesh3d][source]

Returns all traces associated with the detector geometry.

Parameters:
  • meta (Meta, optional) – Metadata information (only needed if pixel_coordinates is True)

  • tpc (bool, default True) – Whether or not to include TPC traces

  • optical (bool, default True) – Whether or not to include optical detector traces

  • crt (bool, default True) – Whether or not to include CRT detector traces

Returns:

List of detector traces

Return type:

List[BaseTraceType]

tpc_traces(meta: Meta | None = None, draw_faces: bool = False, shared_legend: bool = True, name: str = 'TPC', color: int | str | np.ndarray = 'rgba(0,0,0,0.150)', linewidth: int = 5, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Function which produces a list of traces which represent the TPCs in a 3D event display.

Parameters:
  • meta (Meta, optional) – Metadata information (only needed if pixel_coordinates is True)

  • draw_faces (bool, default False) – Weather or not to draw the box faces, or only the edges

  • shared_legend (bool, default True) – If True, the legend entry in plotly is shared between all the TPC volumes

  • name (str, default 'TPC') – Name of the TPC volumes

  • color (Union[int, str, np.ndarray]) – Color of boxes or list of color of boxes

  • linewidth (int, default 2) – Width of the box edge lines

  • **kwargs (dict, optional) – List of additional arguments to pass to spine.viusalization.boxes.box_traces

Returns:

List of detector traces (one per TPC)

Return type:

List[BaseTraceType]

optical_traces(meta: Meta | None = None, shared_legend: bool = True, legendgroup: str | None = None, name: str = 'Optical', color: ColorInput = 'rgba(0,0,255,0.25)', hovertext: HoverTextInput = None, cmin: float | None = None, cmax: float | None = None, zero_supress: bool = False, volume_id: int | None = None, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Function which produces a list of traces which represent the optical detectors in a 3D event display.

Parameters:
  • meta (Meta, optional) – Metadata information (only needed if pixel_coordinates is True)

  • shared_legend (bool, default True) – If True, the legend entry in plotly is shared between all the optical volumes

  • legendgroup (str, optional) – Legend group to be shared between all boxes

  • name (str, default 'Optical') – Name of the optical volumes

  • color (Union[str, int, float, Sequence]) – Color of the optical detectors, either as one shared value or one value per detector.

  • hovertext (Union[int, float, str, Sequence], optional) – Label or labels associated with each optical detector.

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

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

  • zero_supress (bool, default False) – If True, do not draw optical detectors that are not activated

  • volume_id (int, optional) – Specifies which optical volume to represent. If not specified, all the optical volumes are drawn

  • **kwargs (dict, optional) – List of additional arguments to pass to spine.vis.trace.ellipsoid.ellipsoid_traces or spine.vis.trace.box.box_traces

Returns:

List of optical detector traces (one per optical detector)

Return type:

List[plotly.graph_objs.Mesh3D]

crt_traces(meta: Meta | None = None, draw_faces: bool = True, shared_legend: bool = True, name: str = 'CRT', color: int | str | np.ndarray = 'rgba(0,255,255,0.150)', draw_ids: list[int] | None = None, **kwargs: Any) list[go.Scatter3d | go.Mesh3d][source]

Function which produces a list of traces which represent the optical detectors in a 3D event display.

Parameters:
  • meta (Meta, optional) – Metadata information (only needed if pixel_coordinates is True)

  • draw_faces (bool, default True) – Weather or not to draw the box faces, or only the edges

  • shared_legend (bool, default True) – If True, the legend entry in plotly is shared between all the CRT volumes

  • name (str, default 'CRT') – Name of the CRT volumes

  • color (Union[int, str, np.ndarray]) – Color of CRT detectors or list of color of CRT detectors

  • draw_ids (List[int], optional) – If specified, only the requested CRT planes are drawn

  • **kwargs (dict, optional) – List of additional arguments to pass to spine.vis.trace.ellipsoid.ellipsoid_traces or spine.vis.trace.box.box_traces

Returns:

List of CRT detector traces (one per CRT element)

Return type:

List[plotly.graph_objs.Mesh3D]