Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new "true circle" tool from glue-jupyter #2332

Merged
merged 5 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Specviz2d
Bug Fixes
---------

- Circle tool to create a circular Subset no longer results in an ellipse
under certain conditions. [#2332]

Cubeviz
^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/cubeviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CubevizImageView(JdavizViewerMixin, BqplotImageView):
['jdaviz:homezoom', 'jdaviz:prevzoom'],
['jdaviz:pixelboxzoommatch', 'jdaviz:boxzoom',
'jdaviz:pixelpanzoommatch', 'jdaviz:panzoom'],
['bqplot:circle', 'bqplot:rectangle', 'bqplot:ellipse'],
['bqplot:truecircle', 'bqplot:rectangle', 'bqplot:ellipse'],
['jdaviz:spectrumperspaxel'],
['jdaviz:sidebar_plot', 'jdaviz:sidebar_export']
]
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/imviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ImvizImageView(JdavizViewerMixin, BqplotImageView, AstrowidgetsImageViewer
['jdaviz:homezoom', 'jdaviz:prevzoom'],
['jdaviz:boxzoommatch', 'jdaviz:boxzoom'],
['jdaviz:panzoommatch', 'jdaviz:imagepanzoom'],
['bqplot:circle', 'bqplot:rectangle', 'bqplot:ellipse', 'bqplot:circannulus',
'jdaviz:singlepixelregion'],
['bqplot:truecircle', 'bqplot:rectangle', 'bqplot:ellipse',
'bqplot:circannulus', 'jdaviz:singlepixelregion'],
['jdaviz:blinkonce', 'jdaviz:contrastbias'],
['jdaviz:sidebar_plot', 'jdaviz:sidebar_export', 'jdaviz:sidebar_compass']
]
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/tests/test_linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_wcslink_affine_with_extras(self):
self.viewer.cuts = (0, 100)

# Add subsets, both interactive and static.
self.imviz._apply_interactive_region('bqplot:circle', (1.5, 2.5), (3.6, 4.6))
self.imviz._apply_interactive_region('bqplot:truecircle', (1.5, 2.5), (3.6, 4.6))
self.imviz.load_regions([CirclePixelRegion(center=PixCoord(x=6, y=2), radius=5),
PolygonPixelRegion(vertices=PixCoord(x=[1, 2, 2], y=[1, 1, 2])),
PolygonPixelRegion(vertices=PixCoord(x=[2, 3, 3], y=[2, 2, 3]))])
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def test_parse_jwst_nircam_level2(self, imviz_helper):
# --- Since download is expensive, we attach GWCS-specific tests here. ---

# Ensure interactive region supports GWCS. Also see test_regions.py
imviz_helper._apply_interactive_region('bqplot:circle',
imviz_helper._apply_interactive_region('bqplot:truecircle',
(965, 1122),
(976.9, 1110.1)) # Star
imviz_helper._apply_interactive_region('bqplot:rectangle',
Expand Down
6 changes: 3 additions & 3 deletions jdaviz/configs/imviz/tests/test_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_regions_pixel(self):

def test_regions_sky_has_wcs(self):
# Mimic interactive region (before)
self.imviz._apply_interactive_region('bqplot:circle', (1.5, 2.5), (3.6, 4.6))
self.imviz._apply_interactive_region('bqplot:truecircle', (1.5, 2.5), (3.6, 4.6))

sky = SkyCoord(ra=337.5202808, dec=-20.833333059999998, unit='deg')
# These will become indistinguishable from normal Subset.
Expand Down Expand Up @@ -234,9 +234,9 @@ def test_ds9_load_one_good_one_bad(self, imviz_helper):
class TestGetInteractiveRegions(BaseImviz_WCS_NoWCS):
def test_annulus(self):
# Outer circle
self.imviz._apply_interactive_region('bqplot:circle', (0, 0), (9, 9))
self.imviz._apply_interactive_region('bqplot:truecircle', (0, 0), (9, 9))
# Inner circle
self.imviz._apply_interactive_region('bqplot:circle', (2, 2), (7, 7))
self.imviz._apply_interactive_region('bqplot:truecircle', (2, 2), (7, 7))

# At this point, there should be two normal circles.
subsets = self.imviz.get_interactive_regions()
Expand Down
6 changes: 3 additions & 3 deletions jdaviz/configs/imviz/tests/test_simple_aper_phot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class TestSimpleAperPhot(BaseImviz_WCS_WCS):
def test_plugin_wcs_dithered(self):
self.imviz.link_data(link_type='wcs') # They are dithered by 1 pixel on X
self.imviz._apply_interactive_region('bqplot:circle', (0, 0), (9, 9)) # Draw a circle
self.imviz._apply_interactive_region('bqplot:truecircle', (0, 0), (9, 9)) # Draw a circle

phot_plugin = self.imviz.app.get_tray_item_from_name('imviz-aper-phot-simple')

Expand Down Expand Up @@ -171,7 +171,7 @@ def test_plugin_wcs_dithered(self):
class TestSimpleAperPhot_NoWCS(BaseImviz_WCS_NoWCS):
def test_plugin_no_wcs(self):
# Most things already tested above, so not re-tested here.
self.imviz._apply_interactive_region('bqplot:circle', (0, 0), (9, 9)) # Draw a circle
self.imviz._apply_interactive_region('bqplot:truecircle', (0, 0), (9, 9)) # Draw a circle
phot_plugin = self.imviz.app.get_tray_item_from_name('imviz-aper-phot-simple')

phot_plugin.dataset_selected = 'has_wcs[SCI,1]'
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_annulus_background(imviz_helper):

# Mark an object of interest
# CirclePixelRegion(center=PixCoord(x=150, y=25), radius=7)
imviz_helper._apply_interactive_region('bqplot:circle', (143, 18), (157, 32))
imviz_helper._apply_interactive_region('bqplot:truecircle', (143, 18), (157, 32))

# Load annulus (this used to be part of the plugin but no longer)
annulus_1 = CircleAnnulusPixelRegion(
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/tests/test_subsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_region_from_subset_3d(cubeviz_helper):
# Circular Subset
flux_viewer = cubeviz_helper.app.get_viewer("flux-viewer")
# We set the active tool here to trigger a reset of the Subset state to "Create New"
flux_viewer.toolbar.active_tool = flux_viewer.toolbar.tools['bqplot:circle']
flux_viewer.toolbar.active_tool = flux_viewer.toolbar.tools['bqplot:truecircle']
cubeviz_helper.app.get_viewer('flux-viewer').apply_roi(CircularROI(xc=3, yc=4, radius=2.4))
assert subset_plugin.subset_selected == "Subset 2"
assert subset_plugin.subset_types == ["CircularROI"]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"bqplot>=0.12.37",
"bqplot-image-gl>=1.4.11",
"glue-core>=1.11",
"glue-jupyter>=0.17",
"glue-jupyter>=0.18",
"echo>=0.5.0",
"ipykernel>=6.19.4",
"ipyvue>=1.6",
Expand Down
Loading