Skip to content

Commit

Permalink
Fix issues with getting/calling stretches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Aug 18, 2023
1 parent d24c2fb commit bf2fad9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions glue_plotly/common/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Check warning on line 142 in glue_plotly/common/image.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/common/image.py#L142

Added line #L142 was not covered by tests
except TypeError:
return stretches[stretch_name]
return stretches[stretch_name]()

Check warning on line 144 in glue_plotly/common/image.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/common/image.py#L144

Added line #L144 was not covered by tests


def colorscale_info(layer_state, interval, contrast_bias):
Expand All @@ -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)))

Check warning on line 154 in glue_plotly/common/image.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/common/image.py#L154

Added line #L154 was not covered by tests
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]
Expand Down Expand Up @@ -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)))

Check warning on line 332 in glue_plotly/common/image.py

View check run for this annotation

Codecov / codecov/patch

glue_plotly/common/image.py#L332

Added line #L332 was not covered by tests
img[np.isnan(img)] = 0

z_bounds, colorscale = colorscale_info(layer_state, interval, constrast_bias)
Expand Down

0 comments on commit bf2fad9

Please sign in to comment.