From bf2fad96d34a57e1530cd44f3acc6e8065fee243 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Fri, 18 Aug 2023 15:14:09 -0400 Subject: [PATCH] Fix issues with getting/calling stretches. --- glue_plotly/common/image.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glue_plotly/common/image.py b/glue_plotly/common/image.py index e1dda83..5827f87 100644 --- a/glue_plotly/common/image.py +++ b/glue_plotly/common/image.py @@ -139,9 +139,9 @@ def image_size_info(layer_state): def get_stretch(stretch_name): try: - return stretches(stretch_name) + return stretches.members[stretch_name] except TypeError: - return stretches[stretch_name] + return stretches[stretch_name]() def colorscale_info(layer_state, interval, contrast_bias): @@ -151,7 +151,7 @@ def colorscale_info(layer_state, interval, contrast_bias): else: cmap = layer_state.cmap bounds = [layer_state.v_min, layer_state.v_max] - mapped_bounds = get_stretch(layer_state.stretch)()(contrast_bias(interval(bounds))) + mapped_bounds = get_stretch(layer_state.stretch)(contrast_bias(interval(bounds))) unmapped_space = np.linspace(0, 1, 60) mapped_space = np.linspace(mapped_bounds[0], mapped_bounds[1], 60) color_space = [cmap(b)[:3] for b in mapped_space] @@ -329,7 +329,7 @@ def traces_for_image_layer(layer): if np.isscalar(array): array = np.atleast_2d(array) - img = get_stretch(layer_state.stretch)()(constrast_bias(interval(array))) + img = get_stretch(layer_state.stretch)(constrast_bias(interval(array))) img[np.isnan(img)] = 0 z_bounds, colorscale = colorscale_info(layer_state, interval, constrast_bias)