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

Prevent destruction of CircularAnnulusROI by resizing below inner_radius #383

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

dhomeier
Copy link
Contributor

@dhomeier dhomeier commented Aug 12, 2023

Description

#376 (comment) brought to light an issue with the little-documented resize functionality of the bqplot brush tool when modifying BqplotCircularAnnulusMode: since the update from the modified self._roi only changes the outer and not the inner radius, it is possible to decrease the former below an invalid value outer_radius <= inner_radius, as a result destroying the subregion. This PR prevents this by keeping inner_radius just below outer_radius.
Such a minimal-width circular annulus will typically become impossible to manipulate interactively, but it still exists and can e.g. be restored to some sensible inner radius via the menu.

Screenshot 2023-08-12 at 4 54 29 pm

Screenshot 2023-08-12 at 5 01 40 pm

I have added a basic test for creating this subset type, but was unable to emulate even the move operation this way, let alone resizing – pointers how to do this with tool.interact welcome.

@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Patch coverage: 93.75% and project coverage change: +0.43% 🎉

Comparison is base (0be614f) 86.91% compared to head (2c2aa86) 87.35%.
Report is 11 commits behind head on main.

❗ Current head 2c2aa86 differs from pull request most recent head ca50995. Consider uploading reports for the commit ca50995 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #383      +/-   ##
==========================================
+ Coverage   86.91%   87.35%   +0.43%     
==========================================
  Files          89       89              
  Lines        4990     5004      +14     
==========================================
+ Hits         4337     4371      +34     
+ Misses        653      633      -20     
Files Changed Coverage Δ
glue_jupyter/bqplot/common/tools.py 70.13% <0.00%> (+4.62%) ⬆️
glue_jupyter/bqplot/image/viewer.py 87.50% <ø> (ø)
glue_jupyter/bqplot/tests/test_bqplot.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tool.interact.selected = [(150.0, 275.0), (150.0, 325.0)]
tool.interact.brushing = False
assert_allclose(roi.xc, 151.00)
# assert_allclose(roi.yc, 326.75) # trying to use `move`, but this is not how it works...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment. Is there a bug that need fixing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "bug" is me not knowing how to work with tool.interact to reproduce the interaction of clicking inside the subset, then dragging it 50 pixels upwards and release it (i.e. do a move of +50 pixels in y). Just left here as a reminder, but if I don't find a solution, the commented part can be removed again.

@dhomeier dhomeier marked this pull request as ready for review August 16, 2023 23:23
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, thanks! But as noted in #376 (comment) I don't think we should be adding more default tools for now.

@pllim
Copy link
Contributor

pllim commented Aug 17, 2023

Is there a way to test stuff without having to add things to default tools proper?

@astrofrog astrofrog merged commit c98cb9d into glue-viz:main Aug 23, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants