Skip to content

Commit

Permalink
Merge pull request #2425 from gluesolutions/fix-size-of-incompatible-…
Browse files Browse the repository at this point in the history
…image-subsets

Set incompatible image subset from bounds
  • Loading branch information
astrofrog authored Oct 23, 2023
2 parents 90955df + c501f5b commit df7599f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions glue/viewers/image/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,19 @@ def __call__(self, bounds):
if (self.layer_artist is None or
self.layer_state is None or
self.viewer_state is None):
return np.broadcast_to(np.nan, self.shape)
return None

# We should compute the mask even if the layer is not visible as we need
# the layer to show up properly when it is made visible (which doesn't
# trigger __getitem__)
# trigger __getitem__). However, if the layer is disabled, then we will
# call this method when it is enabled, so in this case we just return
# an empty mask.

try:
mask = self.layer_state.get_sliced_data(bounds=bounds)
except IncompatibleAttribute:
self.layer_artist.disable_incompatible_subset()
return np.broadcast_to(np.nan, self.shape)
return None
else:
self.layer_artist.enable(redraw=False)

Expand Down

0 comments on commit df7599f

Please sign in to comment.