Skip to content

Commit

Permalink
Properly handle image limit units in layer artist
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Mar 28, 2024
1 parent 28a47d6 commit 3a82065
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion glue/viewers/image/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
PixelAlignedDataChangedMessage)
from glue.viewers.image.frb_artist import imshow
from glue.core.fixed_resolution_buffer import ARRAY_CACHE, PIXEL_CACHE
from glue.core.units import UnitConverter


class BaseImageLayerArtist(MatplotlibLayerArtist, HubListener):
Expand Down Expand Up @@ -160,8 +161,18 @@ def _update_visual_attributes(self):
else:
self.composite.mode = 'color'

# As the levels may be specified in a different unit we should convert
# them to the native data units.

converter = UnitConverter()

Check warning on line 167 in glue/viewers/image/layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue/viewers/image/layer_artist.py#L167

Added line #L167 was not covered by tests

clim = tuple(converter.to_native(self.state.layer,

Check warning on line 169 in glue/viewers/image/layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue/viewers/image/layer_artist.py#L169

Added line #L169 was not covered by tests
self.state.attribute,
np.hstack([self.state.v_min, self.state.v_max]),
self.state.attribute_display_unit))

self.composite.set(self.uuid,
clim=(self.state.v_min, self.state.v_max),
clim=clim,
visible=self.state.visible,
zorder=self.state.zorder,
color=self.state.color,
Expand Down

0 comments on commit 3a82065

Please sign in to comment.