Skip to content

Commit

Permalink
Disallow pixel markers when linked by WCS
Browse files Browse the repository at this point in the history
and fix relevant test.
  • Loading branch information
pllim authored and bmorris3 committed Nov 6, 2023
1 parent 37f41fb commit 9572b49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jdaviz/configs/imviz/tests/test_linking.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from astropy.table import Table
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.wcs import WCS
from glue.core.link_helpers import LinkSame
from glue.plugins.wcs_autolinking.wcs_autolinking import AffineLink, OffsetLink
Expand Down Expand Up @@ -119,8 +120,8 @@ def test_wcslink_affine_with_extras(self):
PolygonPixelRegion(vertices=PixCoord(x=[2, 3, 3], y=[2, 2, 3]))])

# Add markers.
tbl = Table({'x': (0, 0), 'y': (0, 1)})
self.viewer.add_markers(tbl, marker_name='xy_markers')
tbl = Table({'coord': [SkyCoord(337.5203, -20.8333, unit="deg")]})
self.viewer.add_markers(tbl, use_skycoord=True, marker_name='xy_markers')
assert 'xy_markers' in self.imviz.app.data_collection.labels

# linking shouldn't be possible now because astrowidgets creates a data entry
Expand Down
2 changes: 2 additions & 0 deletions jdaviz/core/astrowidgets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ def add_markers(self, table, x_colname='x', y_colname='y',
jglue.data_collection[marker_name] = t_glue
jglue.add_link(t_glue, 'ra', image, ra_str)
jglue.add_link(t_glue, 'dec', image, dec_str)
elif self.jdaviz_app.config == "imviz" and self.jdaviz_app._link_type == "wcs":
raise TypeError("Cannot add markers in pixel space when linked by WCS.")
else:
t_glue = Data(marker_name, **table[x_colname, y_colname])
with jglue.data_collection.delay_link_manager_update():
Expand Down

0 comments on commit 9572b49

Please sign in to comment.