-
Notifications
You must be signed in to change notification settings - Fork 38
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
Allow enforcing persistenly circular ROI in draw tool #376
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #376 +/- ##
==========================================
+ Coverage 86.65% 86.95% +0.29%
==========================================
Files 89 89
Lines 4940 4984 +44
==========================================
+ Hits 4281 4334 +53
+ Misses 659 650 -9
☔ View full report in Codecov by Sentry. |
Hi @dhomeier, I tried testing your solution here, but I am encountering an error when opening jdaviz in stand alone mode: I think I have the exact workflow where I see the problem. It happens when I pop out the viewer from the notebook. When popped out, the x,y aspect ratio is not retained (spacetelescope/jdaviz#2187) and that is why a circular subset becomes an ellipse. We need to fix the aspect ratio bug, but I still think that a circle should be a circle regardless. Let me know if I need to do something different to test this PR. I can send a video of how I trigger the problem if that can be helpful. Thank you! |
Thanks for the details, I had been missing that you were creating a new window for the viewer here as well! Your failure in launching jdaviz in the first place is due to the missing fix for |
@dhomeier , this line needs to be changed in Imviz to use your new feature: @camipacifici , your error is from #363 (review) and looks like it is being fixed over at #375 . |
Yes it should. I'll probably have the final version raise a |
To get past that, you can temporarily ignore that echo warning in Jdaviz |
Yes, putting it there rather than playing around in |
Re: #376 (comment) Are you sure you are not working off an old copy of Jdaviz code? We don't pin to But the duplication in |
No, was checking what you were running in your CI, but misread |
@dhomeier , I created spacetelescope/jdaviz#2332 to test this downstream. Seems to work as expected. Thanks! |
4c69cd6
to
7ccb5a4
Compare
Already did; something must have stalled when pushing. |
The third commit after rebase looks unrelated. |
Re: #376 (comment) What does "resizing" mean? How and what do you "resize"? |
Yes, but necessary for |
In the image example the (only) Subset0, originally linked to a |
@dhomeier I think the DeprecationWarning fix should be its own PR and merged immediately. Thanks! |
Will rebase again once #379 is approved and merged. |
I have now implemented your idea from the SME meeting defining this as a class, so that initialising from a
breaks the drag-and-move mode when first initialising the brush selector, so I moved the functionality to update_from_roi instead).Having strict_circle also as a kwarg complicates things a bit in this version, and has become pretty much redundant anyway, so perhaps it should just be removed?I have verified resizing in the Voila app and ran Jdaviz tests locally, but did not check against the non-Imviz case as in #370 (comment) |
glue_jupyter/bqplot/common/tools.py
Outdated
|
||
super().__init__(viewer, **kwargs) | ||
|
||
if kwargs.pop('strict_circle', True) is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree this is redundant. What do you think, @astrofrog ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree
We don't have any tests directly calling the |
This comment was marked as outdated.
This comment was marked as outdated.
@@ -5,6 +5,7 @@ | |||
from nbconvert.preprocessors import ExecutePreprocessor | |||
from glue.core import Data | |||
from glue.core.roi import EllipticalROI | |||
from ..common.tools import TrueCircularROI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need relative import in Python 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno, is it discouraged now?
Oh, you mean test for mode, not the tool, nevermind, please ignore my comment about test. I don't need new tests beyond what you added here. |
I did pull in your test and added another one for the TrueCircle version; should have listed you as co-author. |
Thanks, @dhomeier ! Please let us know when this feature is released, so I can revisit the downstream PR. |
@astrofrog how about a bugfix release once #384 and #385 are in, and perhaps see if we can get #383 finished within a day or so? |
Sounds good - although maybe a minor version rather than bugfix since this is a new feature? |
Yeah, strictly speaking, it is a new feature though it acts like a bug in Jdaviz (mainly due to user confusion). |
@astrofrog, in view of the screenshot above (which is from #383) I am wondering which of the new subset tools should remain enabled by default. I had added them just because I did not know how to make them available in the tests otherwise, but I think the "circular annulus" would be genuinely useful. But "circular" and "strictly circular" may be more confusing in the present form; perhaps renaming it again to "persistent circular" would be a bit clearer, but I can't think of a good icon to symbolise that (maybe changing the non-persistent one to something combining circular and elliptic shapes). Or is there a way to add this to |
The annulus one would only make sense to include by default if we had a way to edit the inner radius - which I don't think we do here? (but there is in jdaviz) You can add some of these just for tests by making a test viewer subclass where you edit the tools attribute - I think that's probably the easiest way. For now I don't think the strict circular mode should be enabled by default until we've had a bit more time to think about it - for instance it will only really be intuitive in the image viewer if aspect is equal, but if aspect is auto it will be a bit confusing. For now I would prefer to not expose this except in jdaviz. So for now I would leave out the annulus and strict circle tools from the defaults. |
Isn't there a way to access the subset through
I've tried to do that, but could not figure out yet how the |
@dhomeier If it helps, the |
Thanks @Carifio24 , exactly the bit of info I needed! In ca50995 tests are working with just calling |
* Use truecircle tool from glue-viz/glue-jupyter#376 * MNT: Bump glue-jupyter minversion that can use this new tool * Add change log * Fix line too long * Fix change log verbiage Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
* Use truecircle tool from glue-viz/glue-jupyter#376 * MNT: Bump glue-jupyter minversion that can use this new tool * Add change log * Fix line too long * Fix change log verbiage Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com>
fix event handling for choosing config from launcher filepath fallback when object from config-detection fails to load fix: support for notebook 7 (spacetelescope#2420) Notebook 7 requires a different way to detect if the app runs in a notebook context. Fix explanation in markdown cell. DOC: Footprints plugin API docs (spacetelescope#2426) * build footprints API docs * add code snippet in plugin docs * fix syntax in API docs --------- Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> prevent overwriting user-API methods (spacetelescope#2425) fix default color for overlay when traitlet set by user * for the FIRST overlay, the user could have set the color traitlet before the internal overlay object is created (which occurs as soon as the plugin is first shown). In that case, we want to respect the user choice of color. similar fixes for any other traitlet when plugin inactive regression test change log entry fix API import of single region and overwriting existing entry * along with regression testing TST: Also pull in scikit-image dev to get rid of incompatibility with numpy Use new "true circle" tool from glue-jupyter (spacetelescope#2332) * Use truecircle tool from glue-viz/glue-jupyter#376 * MNT: Bump glue-jupyter minversion that can use this new tool * Add change log * Fix line too long * Fix change log verbiage Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> Enable multiselect in subset plugin for recentering (spacetelescope#2430) * Enable multiselect in subset plugin for recentering * Fix bug with default text * Remove unused import * Fix bug in aperature photometry * Address review comments * Remove commented out code * Add initial tests * Fix bug when exiting multiselect and switching subsets * Add documentation and update CHANGES file * Remove print statement * Add comment about recentering taking multiple iterations to docs * fix chip styling in subset dropdown * only set selected_has_subregions if exists * only show multiselect toggle in imviz * Apply suggestions from code review Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> Debug standalone build (spacetelescope#2441) * Log jdaviz output for debugging * Run workflow on debugging branch * See if collecting data from jupyter-client will fix this, otherwise might need to downgrade * Remove debugging stuff MNT: Bump actions/checkout to v4 Enable workflow_dispatch for standalone because it cannot be enabled outside of main apparently [ci skip] [rtd skip] EXP: Update workflow versions Fix Mosviz slit overlay (spacetelescope#2434) * Fix Mosviz slit overlay by using polygon instead of forcing a rectangle without angle info. Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com> * Off by one error in predicted PR num --------- Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com> API access (hidden) to disable cubeviz movie UI (spacetelescope#2440) * (hidden) API access to disable cubeviz movie UI * default movie_enabled based on new app-setting server_is_remote * test coverage TST: Ignore ASDF warning about gwcs-1.0.0 schema because gwcs dev and/or asdf-wcs-schemas 0.2.0 triggers the warning because the schema is no longer supported.
fix event handling for choosing config from launcher filepath fallback when object from config-detection fails to load fix: support for notebook 7 (spacetelescope#2420) Notebook 7 requires a different way to detect if the app runs in a notebook context. Fix explanation in markdown cell. DOC: Footprints plugin API docs (spacetelescope#2426) * build footprints API docs * add code snippet in plugin docs * fix syntax in API docs --------- Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> prevent overwriting user-API methods (spacetelescope#2425) fix default color for overlay when traitlet set by user * for the FIRST overlay, the user could have set the color traitlet before the internal overlay object is created (which occurs as soon as the plugin is first shown). In that case, we want to respect the user choice of color. similar fixes for any other traitlet when plugin inactive regression test change log entry fix API import of single region and overwriting existing entry * along with regression testing TST: Also pull in scikit-image dev to get rid of incompatibility with numpy Use new "true circle" tool from glue-jupyter (spacetelescope#2332) * Use truecircle tool from glue-viz/glue-jupyter#376 * MNT: Bump glue-jupyter minversion that can use this new tool * Add change log * Fix line too long * Fix change log verbiage Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> Enable multiselect in subset plugin for recentering (spacetelescope#2430) * Enable multiselect in subset plugin for recentering * Fix bug with default text * Remove unused import * Fix bug in aperature photometry * Address review comments * Remove commented out code * Add initial tests * Fix bug when exiting multiselect and switching subsets * Add documentation and update CHANGES file * Remove print statement * Add comment about recentering taking multiple iterations to docs * fix chip styling in subset dropdown * only set selected_has_subregions if exists * only show multiselect toggle in imviz * Apply suggestions from code review Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --------- Co-authored-by: Kyle Conroy <kyleconroy@gmail.com> Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> Debug standalone build (spacetelescope#2441) * Log jdaviz output for debugging * Run workflow on debugging branch * See if collecting data from jupyter-client will fix this, otherwise might need to downgrade * Remove debugging stuff MNT: Bump actions/checkout to v4 Enable workflow_dispatch for standalone because it cannot be enabled outside of main apparently [ci skip] [rtd skip] EXP: Update workflow versions Fix Mosviz slit overlay (spacetelescope#2434) * Fix Mosviz slit overlay by using polygon instead of forcing a rectangle without angle info. Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com> * Off by one error in predicted PR num --------- Co-authored-by: Camilla Pacifici <camilla.pacifici@gmail.com> API access (hidden) to disable cubeviz movie UI (spacetelescope#2440) * (hidden) API access to disable cubeviz movie UI * default movie_enabled based on new app-setting server_is_remote * test coverage TST: Ignore ASDF warning about gwcs-1.0.0 schema because gwcs dev and/or asdf-wcs-schemas 0.2.0 triggers the warning because the schema is no longer supported.
Description
Substitute for #370 that does not alter the default behaviour (of drawing an ellipse when x and y radius are > 2 % different), to avoid issues as #370 (comment).
Instead returning a
CircularROI
is only enforced by setting a kwargstrict_circle=True
, which is made available as default inBqplotTrueCircleMode
and'bqplot:truecircle'
.@camipacifici, @pllim I checked with the tests adapted from #370, but could not test the Jdaviz examples, since I cannot reproduce the original issue with either workflow at the moment. But replacing
BqplotCircleMode
withBqplotTrueCircleMode
in Jdaviz tools with this PR should in hopefully fix them.@astrofrog yet to decide if this is to be exposed by a public kwarg; also not sure if we still need the additional interface (and test) through
'bqplot:ellipse'
with this approach.