From b5f42874972907803f9576a5f73082ff1d193192 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Fri, 25 Aug 2023 08:37:48 -0400 Subject: [PATCH] fix subset histogram update bug in plot options --- CHANGES.rst | 3 +++ jdaviz/configs/default/plugins/plot_options/plot_options.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 2c44f8b8b6..7f7b7c7d41 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -95,6 +95,9 @@ Bug Fixes the selection when the choices change if any of the previous entries are still valid. [#2344] +- Fixed Plot Options stretch histogram bug that raised an error when a spatial subset + was selected in Imviz and Cubeviz. [#2393] + Cubeviz ^^^^^^^ diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index b75acf75e1..753239869e 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -4,6 +4,7 @@ from astropy.visualization import PercentileInterval from traitlets import Any, Dict, Float, Bool, Int, List, Unicode, observe +from glue.core.subset_group import GroupedSubset from glue.viewers.scatter.state import ScatterViewerState from glue.viewers.profile.state import ProfileViewerState, ProfileLayerState from glue.viewers.image.state import ImageSubsetLayerState @@ -579,6 +580,10 @@ def _update_stretch_histogram(self, msg={}): # skip further updates if no data are available: return + if isinstance(data, GroupedSubset): + # don't update histogram for subsets: + return + comp = data.get_component(data.main_components[0]) # TODO: further optimization could be done by caching sub_data