Skip to content

Commit

Permalink
Import broadcast_to from numpy as it was removed in glue-core
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Feb 11, 2023
1 parent e178332 commit fee68c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions glue_vispy_viewers/volume/layer_artist.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import uuid
import weakref

import numpy as np

from matplotlib.colors import ColorConverter

from glue.core.data import Subset, Data
from glue.core.exceptions import IncompatibleAttribute
from glue.utils import broadcast_to
from glue.core.fixed_resolution_buffer import ARRAY_CACHE, PIXEL_CACHE
from .colors import get_translucent_cmap
from .layer_state import VolumeLayerState
Expand Down Expand Up @@ -45,7 +46,7 @@ def compute_fixed_resolution_buffer(self, bounds=None):
shape = [bound[2] for bound in bounds]

if self.layer_artist is None or self.viewer_state is None:
return broadcast_to(0, shape)
return np.broadcast_to(0, shape)

if isinstance(self.layer_artist.layer, Subset):
try:
Expand All @@ -56,7 +57,7 @@ def compute_fixed_resolution_buffer(self, bounds=None):
cache_id=self.layer_artist.id)
except IncompatibleAttribute:
self.layer_artist.disable_incompatible_subset()
return broadcast_to(0, shape)
return np.broadcast_to(0, shape)
else:
self.layer_artist.enable()
else:
Expand All @@ -67,7 +68,7 @@ def compute_fixed_resolution_buffer(self, bounds=None):
cache_id=self.layer_artist.id)
except IncompatibleAttribute:
self.layer_artist.disable('Layer data is not fully linked to reference data')
return broadcast_to(0, shape)
return np.broadcast_to(0, shape)
else:
self.layer_artist.enable()

Expand Down

0 comments on commit fee68c8

Please sign in to comment.