From 79f628c336dbdf8d4349deea4149c29e8489f27b Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Thu, 26 Oct 2023 13:50:25 -0400 Subject: [PATCH] bugfix for plot opts stretch function in histogram --- .../default/plugins/plot_options/plot_options.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index 89f696e7d6..7a071d3034 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -797,7 +797,7 @@ def _update_stretch_histogram_colorbar(self, msg={}): @observe('is_active', 'stretch_vmin_value', 'stretch_vmax_value', 'layer_selected', 'stretch_hist_nbins', 'image_contrast_value', 'image_bias_value', - 'stretch_curve_visible') + 'stretch_curve_visible', 'image_colormap_value') @skip_if_no_updates_since_last_active() def _update_stretch_curve(self, msg=None): mark_label_prefix = "stretch_curve: " @@ -830,10 +830,9 @@ def _update_stretch_curve(self, msg=None): knot_label = f"{knots_label_prefix}{layer.label}" # create the new/updated mark following the colormapping # procedure in glue's CompositeArray: - interval = ManualInterval(self.stretch_vmin.value, self.stretch_vmax.value) + interval = ManualInterval(self.stretch_vmin_value, self.stretch_vmax_value) contrast_bias = ContrastBiasStretch(layer.state.contrast, layer.state.bias) stretch = stretches.members[layer.state.stretch] - layer_cmap = layer.state.cmap if isinstance(stretch, SplineStretch): knot_x = (self.stretch_vmin_value + @@ -843,11 +842,10 @@ def _update_stretch_curve(self, msg=None): knot_x, knot_y = [], [] # create a photoshop style "curve" for the stretch function - curve_x = np.linspace(self.stretch_vmin.value, self.stretch_vmax.value, 50) - curve_y = interval(curve_x, clip=False) - curve_y = contrast_bias(curve_y, out=curve_y, clip=False) - curve_y = stretch(curve_y, out=curve_y, clip=False) - curve_y = layer_cmap(curve_y)[:, 0] + curve_x = np.linspace(self.stretch_vmin_value, self.stretch_vmax_value, 50) + curve_y = interval(curve_x) + curve_y = contrast_bias(curve_y) + curve_y = stretch(curve_y) for existing_mark_label, mark in self.stretch_histogram.marks.items(): if mark_label == existing_mark_label: