From 77a802306c41f029f2de998aeee02bf9621d5026 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 24 Jun 2024 01:36:51 -0400 Subject: [PATCH 1/2] Work around numpy 2 issue with dendrodram viewer. --- glue_plotly/common/tests/test_dendrogram.py | 6 ++++++ glue_plotly/html_exporters/qt/tests/test_dendrogram.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/glue_plotly/common/tests/test_dendrogram.py b/glue_plotly/common/tests/test_dendrogram.py index 73c301b..f1dfcbd 100644 --- a/glue_plotly/common/tests/test_dendrogram.py +++ b/glue_plotly/common/tests/test_dendrogram.py @@ -4,6 +4,7 @@ from glue.config import settings from glue.core import Data +from glue.tests.helpers import make_skipper from glue_qt.app import GlueApplication from glue_qt.plugins.dendro_viewer import DendrogramViewer @@ -12,6 +13,11 @@ from glue_plotly.common.dendrogram import trace_for_layer, x_axis +NUMPY_LT_2, requires_numpy_lt2 = make_skipper('numpy', version='2.0', skip_if='ge') + + +# Workaround until for the issue solved in https://github.com/glue-viz/glue-qt/pull/19 +@requires_numpy_lt2 class TestDendrogram: def setup_method(self, method): diff --git a/glue_plotly/html_exporters/qt/tests/test_dendrogram.py b/glue_plotly/html_exporters/qt/tests/test_dendrogram.py index 299dea9..9a86ac2 100644 --- a/glue_plotly/html_exporters/qt/tests/test_dendrogram.py +++ b/glue_plotly/html_exporters/qt/tests/test_dendrogram.py @@ -1,6 +1,7 @@ import os from glue.core import Data +from glue.tests.helpers import make_skipper from pytest import importorskip @@ -11,6 +12,11 @@ from .test_base import TestQtExporter # noqa: E402 +NUMPY_LT_2, requires_numpy_lt2 = make_skipper('numpy', version='2.0', skip_if='ge') + + +# Workaround until for the issue solved in https://github.com/glue-viz/glue-qt/pull/19 +@requires_numpy_lt2 class TestDendrogram(TestQtExporter): viewer_type = DendrogramViewer From 40c392b8a45ccf182ebdf11d33935975d20e65cd Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 24 Jun 2024 01:37:18 -0400 Subject: [PATCH 2/2] Fix issue with Plotly colormap validator. --- glue_plotly/common/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glue_plotly/common/image.py b/glue_plotly/common/image.py index 385dae4..a3b47ac 100644 --- a/glue_plotly/common/image.py +++ b/glue_plotly/common/image.py @@ -181,7 +181,7 @@ def colorscale_info(layer_state, interval, contrast_bias): unmapped_space = np.linspace(0, 1, 60) mapped_space = np.linspace(mapped_bounds[0], mapped_bounds[1], 60) color_space = [cmap(b)[:3] for b in mapped_space] - color_values = [tuple(256 * v for v in p) for p in color_space] + color_values = [tuple(float(256 * v) for v in p) for p in color_space] colorscale = [[0, 'rgb{0}'.format(color_values[0])]] + \ [[u, 'rgb{0}'.format(c)] for u, c in zip(unmapped_space, color_values)] + \ [[1, 'rgb{0}'.format(color_values[-1])]]