diff --git a/glue_jupyter/bqplot/image/tests/test_visual.py b/glue_jupyter/bqplot/image/tests/test_visual.py new file mode 100644 index 00000000..60cf4acf --- /dev/null +++ b/glue_jupyter/bqplot/image/tests/test_visual.py @@ -0,0 +1,32 @@ +import numpy as np + +from glue_jupyter import jglue +from glue_jupyter.tests.helpers import visual_widget_test + + +@visual_widget_test +def test_visual_incompatible_subset( + tmp_path, + page_session, + solara_test, +): + + # Regression test for a bug that caused incompatible subsets + # to make the whole image green. + + np.random.seed(12345) + im = np.random.random((64, 64)) + x = np.random.normal(3, 1, 100) + y = np.random.normal(2, 1.5, 100) + + app = jglue() + data1 = app.add_data(image={"image": im})[0] + data2 = app.add_data(catalog={"x": x, "y": y})[0] + scatter = app.imshow(data=data1, show=False) + state1 = data1.pixel_component_ids[1] > 32 + app.data_collection.new_subset_group('image[x] > 32', state1) + state2 = data2.id['x'] > 1 + app.data_collection.new_subset_group('x > 1', state2) + figure = scatter.figure_widget + figure.layout = {"width": "400px", "height": "250px"} + return figure diff --git a/glue_jupyter/tests/images/py311-test-visual.json b/glue_jupyter/tests/images/py311-test-visual.json index c2c0d65c..201da689 100644 --- a/glue_jupyter/tests/images/py311-test-visual.json +++ b/glue_jupyter/tests/images/py311-test-visual.json @@ -1,4 +1,5 @@ { "glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d[chromium]": "edd4e65c87369bc6e403f45e87d914223bc13f42c2f90a55535614923e233c00", "glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_scatter2d_density[chromium]": "60f38b822f89603874cd508e0c320db92185129631dd89a58624dd667eb8a5a7" + "glue_jupyter.bqplot.scatter.tests.test_visual.test_visual_incompatible_subset[chromium]": "60f38b822f89603874cd508e0c320db92185129631dd89a58624dd667eb8a5a7" }