From 1acbed1b5be9c6e75c47b7c5cc55e9045244e63f Mon Sep 17 00:00:00 2001 From: "Pey Lian Lim (Github)" <2090236+pllim@users.noreply.github.com> Date: Wed, 20 Oct 2021 17:57:12 -0400 Subject: [PATCH] Grab subset associated with selected data --- .../plugins/aper_phot_simple/aper_phot_simple.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py index 55769b33e3..a0cc279751 100644 --- a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py +++ b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py @@ -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