From cec600bb54e3701a3210ee97ad01c0f905088d6b Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 5 Dec 2023 20:56:38 -0500 Subject: [PATCH] Compat with glue-core 1.17 --- CHANGES.rst | 2 ++ .../default/plugins/plot_options/plot_options.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 91a1ee6913..ddd374c891 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -65,6 +65,8 @@ Other Changes and Additions Bug Fixes --------- +- Compatibility with glue-core 1.17. [#2591] + Cubeviz ^^^^^^^ diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index 8842ba298b..d2c9dab192 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 @@ import matplotlib import numpy as np +from astropy.utils import minversion from astropy.visualization import ( ManualInterval, ContrastBiasStretch, PercentileInterval ) @@ -32,6 +33,8 @@ __all__ = ['PlotOptions'] +GLUE_LT_1_17 = not minversion("glue", "1.17") + class SplineStretch: """ @@ -89,7 +92,10 @@ def update_knots(self, x, y): # Add the spline stretch to the glue stretch registry if not registered if "spline" not in stretches: - stretches.add("spline", SplineStretch(), display="Spline") + if GLUE_LT_1_17: + stretches.add("spline", SplineStretch(), display="Spline") + else: + stretches.add("spline", SplineStretch, display="Spline") @tray_registry('g-plot-options', label="Plot Options") @@ -102,7 +108,7 @@ class PlotOptions(PluginTemplateMixin): :ref:`public plugin API `: * :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.show` - * :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.open_in_tray` + * :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.open_in_tray` * :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.close_in_tray` * ``viewer`` (:class:`~jdaviz.core.template_mixin.ViewerSelect`): * ``viewer_multiselect`` @@ -846,7 +852,10 @@ def _update_stretch_curve(self, msg=None): # procedure in glue's CompositeArray: interval = ManualInterval(self.stretch_vmin_value, self.stretch_vmax_value) contrast_bias = ContrastBiasStretch(self.image_contrast_value, self.image_bias_value) - stretch = stretches.members[self.stretch_function_value] + if GLUE_LT_1_17: + stretch = stretches.members[self.stretch_function_value] + else: + stretch = stretches.members[self.stretch_function_value]() layer_cmap = layer.state.cmap # show the colorbar