Skip to content

Commit

Permalink
Remove circannulus and truecircle from default tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dhomeier committed Aug 18, 2023
1 parent 2c2aa86 commit ca50995
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions glue_jupyter/bqplot/image/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class BqplotImageView(BqplotBaseView):
_state_cls = BqplotImageViewerState
_options_cls = ImageViewerStateWidget

tools = ['bqplot:home', 'bqplot:panzoom', 'bqplot:rectangle', 'bqplot:circle', 'bqplot:polygon',
'bqplot:ellipse', 'bqplot:truecircle', 'bqplot:circannulus']
tools = ['bqplot:home', 'bqplot:panzoom', 'bqplot:rectangle', 'bqplot:circle',
'bqplot:ellipse', 'bqplot:polygon']

def __init__(self, session):

Expand Down
28 changes: 19 additions & 9 deletions glue_jupyter/bqplot/tests/test_bqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
from numpy.testing import assert_allclose
from nbconvert.preprocessors import ExecutePreprocessor
from glue.config import viewer_tool
from glue.core import Data
from glue.core.roi import CircularAnnulusROI, EllipticalROI
from ..common.tools import TrueCircularROI
Expand Down Expand Up @@ -271,46 +272,55 @@ def test_imshow_circular_brush(app, data_image):
assert_allclose(roi.radius_y, 273.25)


def test_imshow_true_circular_brush(app, data_image):

def test_imshow_elliptical_brush(app, data_image):
v = app.imshow(data=data_image)
v.state.aspect = 'auto'

tool = v.toolbar.tools['bqplot:truecircle']
tool = v.toolbar.tools['bqplot:ellipse']
tool.activate()
tool.interact.brushing = True
tool.interact.selected = [(1.5, 3.5), (300.5, 550)]
tool.interact.brushing = False

roi = data_image.subsets[0].subset_state.roi
assert isinstance(roi, TrueCircularROI)
assert isinstance(roi, EllipticalROI)
assert_allclose(roi.xc, 151.00)
assert_allclose(roi.yc, 276.75)
assert_allclose(roi.radius, 220.2451)


def test_imshow_elliptical_brush(app, data_image):
# Tools that are not part of the default set of BqplotImageView; manually added for testing
def test_imshow_true_circular_brush(app, data_image):

v = app.imshow(data=data_image)
v.state.aspect = 'auto'

tool = v.toolbar.tools['bqplot:ellipse']
tool_id = 'bqplot:truecircle'
mode_cls = viewer_tool.members[tool_id]
v.toolbar.add_tool(mode_cls(v))

tool = v.toolbar.tools[tool_id]
tool.activate()
tool.interact.brushing = True
tool.interact.selected = [(1.5, 3.5), (300.5, 550)]
tool.interact.brushing = False

roi = data_image.subsets[0].subset_state.roi
assert isinstance(roi, EllipticalROI)
assert isinstance(roi, TrueCircularROI)
assert_allclose(roi.xc, 151.00)
assert_allclose(roi.yc, 276.75)
assert_allclose(roi.radius, 220.2451)


def test_imshow_circular_annulus_brush(app, data_image):

v = app.imshow(data=data_image)
v.state.aspect = 'auto'

tool = v.toolbar.tools['bqplot:circannulus']
tool_id = 'bqplot:circannulus'
mode_cls = viewer_tool.members[tool_id]
v.toolbar.add_tool(mode_cls(v))

tool = v.toolbar.tools[tool_id]
tool.activate()
tool.interact.brushing = True
tool.interact.selected = [(1.5, 3.5), (300.5, 550)]
Expand Down

0 comments on commit ca50995

Please sign in to comment.