From d26745896325c9b89e48132c61403f97d4c46163 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Fri, 25 Aug 2023 14:51:40 -0400 Subject: [PATCH] Backport PR #2393: fix subset histogram 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 32c712eaa3..99e31b2c76 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,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 d0fc225b96..c98407dba9 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -6,6 +6,7 @@ from ipywidgets import widget_serialization 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 @@ -570,6 +571,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