Skip to content

Commit

Permalink
Avoid calling ravel() since this causes a copy for cutouts
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Apr 9, 2024
1 parent defe206 commit e7a7589
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,7 @@ def _update_stretch_histogram(self, msg={}):
y_min = max(y_limits.min(), 0)
y_max = y_limits.max()

arr = comp.data[y_min:y_max, x_min:x_max]
sub_data = arr.ravel(order="K")
sub_data = comp.data[y_min:y_max, x_min:x_max]

else:
# spectrum-2d-viewer, for example. We'll assume the viewer
Expand All @@ -993,12 +992,11 @@ def _update_stretch_histogram(self, msg={}):
(y_data >= viewer.state.y_min) &
(y_data <= viewer.state.y_max))

sub_data = comp.data[inds].ravel(order="K")
sub_data = comp.data[inds]

else:
# include all data, regardless of zoom limits
arr = comp.data
sub_data = arr.ravel(order="K")
sub_data = comp.data

self.stretch_histogram.viewer.state.random_subset = RANDOM_SUBSET_SIZE
self.stretch_histogram._update_data('histogram', x=sub_data)
Expand Down

0 comments on commit e7a7589

Please sign in to comment.