Skip to content

Commit

Permalink
Add ensure_numerical call for USDZ colormap attribute values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Jan 11, 2025
1 parent 3190c75 commit 40893ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion glue_ar/common/scatter_usd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict
from typing import List, Optional, Tuple
from glue.utils.array import ensure_numerical

from glue_vispy_viewers.scatter.layer_state import ScatterLayerState
from glue_vispy_viewers.scatter.viewer_state import Vispy3DViewerState
Expand Down Expand Up @@ -118,7 +119,7 @@ def add_scatter_layer_usd(
cmap = layer_state.cmap
cmap_attr = "cmap_attribute" if vispy_layer_state else "cmap_att"
cmap_att = getattr(layer_state, cmap_attr)
cmap_vals = layer_state.layer[cmap_att][mask]
cmap_vals = ensure_numerical(layer_state.layer[cmap_att][mask])
crange = layer_state.cmap_vmax - layer_state.cmap_vmin
normalized = [max(min((cval - layer_state.cmap_vmin) / crange, 1), 0) for cval in cmap_vals]
colors = [tuple(int(256 * c) for c in cmap(norm)[:3]) for norm in normalized]
Expand Down

0 comments on commit 40893ac

Please sign in to comment.