Skip to content

Commit

Permalink
Debugging subset rehoming for Imviz, currently seems to flip x and y
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Aug 30, 2023
1 parent a09830e commit 5f22044
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,7 @@ def remove_data_from_viewer(self, viewer_reference, data_label):
data_label : str
The Glue data label found in the ``DataCollection``.
"""
print(f"Removing {data_label} from viewer")
viewer_item = self._get_viewer_item(viewer_reference)
viewer_id = viewer_item['id']
viewer = self.get_viewer_by_id(viewer_id)
Expand All @@ -1532,18 +1533,15 @@ def remove_data_from_viewer(self, viewer_reference, data_label):
# Set subset attributes to match remaining data.
for l in viewer.layers:
if hasattr(l.layer, "subset_state"):
for att in ("att", "x_att", "y_att"):
for att in ("att", "xatt", "yatt", "x_att", "y_att"):
if hasattr(l.layer.subset_state, att):
subset_att = getattr(l.layer.subset_state, att)
print(f"Got {subset_att} for {att}")
data_components = l.layer.data.components
if subset_att not in data_components:
new_atts = []
a_labels = [a.label for a in l.layer.subset_state.attributes]
for label in a_labels:
cid = [c for c in data_components if c.label == label][0]
new_atts.append(cid)
new_atts = tuple(new_atts)
l.layer.subset_state.att = new_atts[0]
cid = [c for c in data_components if c.label == subset_att.label][0]
print(f"Didn't find in data components, setting to {cid}")
setattr(l.layer.subset_state, att, cid)

remove_data_message = RemoveDataMessage(data, viewer,
viewer_id=viewer_id,
Expand Down

0 comments on commit 5f22044

Please sign in to comment.