Skip to content

Commit b882f64

Browse files
Use Spine attr_names for hover attributes
1 parent 9416e2a commit b882f64

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Use `attr_names()` to populate valid SPINE hover attributes, including
10+
derived quantities such as `RecoParticle.ke`, while excluding `points*`
11+
location fields from the attribute dropdown.
812

913
## [0.4.2] - 2026-05-11
1014
### Fixed

src/spinal_tap/callbacks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Defines the callbacks of the Spinal Tap application."""
22

3-
from dataclasses import asdict
4-
53
import numpy as np
64
import spine.data.out
75
from dash import ctx, dcc, html, no_update
@@ -662,12 +660,16 @@ def update_attr_list(mode, obj):
662660
if mode != "truth":
663661
cls_name = f"Reco{obj[:-1].capitalize()}"
664662
cls_obj = getattr(spine.data.out, cls_name)()
665-
attrs.update(set(asdict(cls_obj).keys()))
663+
attrs.update(
664+
attr for attr in cls_obj.attr_names() if not attr.startswith("points")
665+
)
666666

667667
if mode != "reco":
668668
cls_name = f"Truth{obj[:-1].capitalize()}"
669669
cls_obj = getattr(spine.data.out, cls_name)()
670-
attrs.update(set(asdict(cls_obj).keys()))
670+
attrs.update(
671+
attr for attr in cls_obj.attr_names() if not attr.startswith("points")
672+
)
671673

672674
return np.sort(list(attrs))
673675

0 commit comments

Comments
 (0)