Skip to content

Commit

Permalink
bugfix for plot opts stretch function in histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Oct 26, 2023
1 parent 0e8981c commit 79f628c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down Expand Up @@ -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 +
Expand All @@ -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:
Expand Down

0 comments on commit 79f628c

Please # to comment.