Skip to content

Commit 2725b8f

Browse files
Fixed attribute list allowed to be displayed/used as color
1 parent 75effd5 commit 2725b8f

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

src/spinal_tap/callbacks.py

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

3+
from dataclasses import asdict
4+
35
import numpy as np
46
import spine.data.out
57
from dash import ctx, dcc, no_update
@@ -607,23 +609,13 @@ def update_attr_list(mode, obj):
607609
attrs = set()
608610
if mode != "truth":
609611
cls_name = f"Reco{obj[:-1].capitalize()}"
610-
cls = getattr(spine.data.out, cls_name)
611-
attrs.update({"depositions"})
612-
attrs.update(set(cls().as_dict().keys()))
612+
cls_obj = getattr(spine.data.out, cls_name)()
613+
attrs.update(set(asdict(cls_obj).keys()))
613614

614615
if mode != "reco":
615616
cls_name = f"Truth{obj[:-1].capitalize()}"
616-
cls = getattr(spine.data.out, cls_name)
617-
attrs.update(
618-
{
619-
"depositions",
620-
"depositions_q",
621-
"depositions_adapt",
622-
"depositions_adapt_q",
623-
"depositions_g4",
624-
}
625-
)
626-
attrs.update(set(cls().as_dict().keys()))
617+
cls_obj = getattr(spine.data.out, cls_name)()
618+
attrs.update(set(asdict(cls_obj).keys()))
627619

628620
return np.sort(list(attrs))
629621

@@ -650,6 +642,7 @@ def update_attr_color_list(attrs):
650642
for attr in attrs:
651643
if (
652644
attr.startswith("depositions")
645+
or attr.startswith("sources")
653646
or attr.startswith("is_")
654647
or attr.endswith("id")
655648
or attr in ["shape", "pid"]

0 commit comments

Comments
 (0)