Skip to content

Commit

Permalink
Grab subset associated with selected data
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Oct 20, 2021
1 parent 12b22ac commit 1acbed1
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ def vue_data_selected(self, event):

def vue_subset_selected(self, event):
subset = None
viewer = self.app.get_viewer_by_id(self._selected_viewer_id)
for lyr in viewer.state.layers:
if lyr.layer.label == event:
subset = lyr.layer
break
try:
# TODO: Is this accurate for dithered images linked by WCS?
viewer = self.app.get_viewer_by_id(self._selected_viewer_id)
for lyr in viewer.layers:
if lyr.layer.label == event and lyr.layer.data.label == self._selected_data.label:
subset = lyr.layer
break

# TODO: https://github.com/glue-viz/glue-astronomy/issues/52
self._selected_subset = subset.data.get_selection_definition(
subset_id=event, format='astropy-regions')
self._selected_subset.meta['label'] = subset.label
Expand Down

0 comments on commit 1acbed1

Please sign in to comment.