Skip to content

Commit

Permalink
fix reference to plugins in metadata (#2826)
Browse files Browse the repository at this point in the history
* fix reference to plugins in metadata

* changed to be the human-friendly name in #2680, but missed updating a few cases, resulting in moment maps not being linked correctly

* TST: Add link cids check
as regression test. This check currently fails on main but should be passing
as part of PR 2826

---------

Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
  • Loading branch information
kecnry and pllim authored Apr 23, 2024
1 parent 3c3e174 commit 638f852
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ def _link_new_data(self, reference_data=None, data_to_be_linked=None):
dc.add_link(links)
return

elif (linked_data.meta.get('Plugin', None) == 'SpectralExtraction' or
(linked_data.meta.get('Plugin', None) == ('GaussianSmooth') and
elif (linked_data.meta.get('Plugin', None) == 'Spectral Extraction' or
(linked_data.meta.get('Plugin', None) == ('Gaussian Smooth') and
linked_data.ndim < 3 and # Cube linking requires special logic. See below
ref_data.ndim < 3)
):
Expand Down Expand Up @@ -749,7 +749,7 @@ def _link_new_data(self, reference_data=None, data_to_be_linked=None):
ref_index = ind
if (len_linked_pixel == 2 and
(linked_data.meta.get("Plugin", None) in
['MomentMap', 'Collapse'])):
['Moment Maps', 'Collapse'])):
if pixel_coord == 'z':
linked_index = pc_linked.index('x')
elif pixel_coord == 'y':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def test_moment_calculation(cubeviz_helper, spectrum1d_cube, tmp_path):
assert len(dc.links) == 22
assert len(dc.external_links) == 4 # pixel linked
# Link 3D z to 2D x and 3D y to 2D y
assert (dc.external_links[0].cids1[0].label == "Pixel Axis 0 [z]" and
dc.external_links[0].cids2[0].label == "Pixel Axis 1 [x]" and
dc.external_links[1].cids1[0].label == "Pixel Axis 1 [y]" and
dc.external_links[1].cids2[0].label == "Pixel Axis 0 [y]")

# Coordinate display should be unaffected.
label_mouseover._viewer_mouse_event(flux_viewer, {'event': 'mousemove',
Expand Down

0 comments on commit 638f852

Please sign in to comment.