-
Notifications
You must be signed in to change notification settings - Fork 75
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
exclude WCS-only layer subsets from plot options #2699
Conversation
4e5e2a6
to
c624fdc
Compare
* both sync state and the visibility mixed state for the viewer select tabs
c624fdc
to
4de1879
Compare
layer.add_callback('color', self._update_layer_items) | ||
layer.add_callback('visible', self._update_layer_items) | ||
break |
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.
this had to be removed in order for mixed state of new subsets to be shown correctly on the tabs
def is_wcs_only(layer): | ||
return getattr(layer.layer, 'meta', {}).get(self.app._wcs_only_label, 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.
now use the consolidated version imported from utils
elif isinstance(self.value, (int, float)) and self._glue_name != 'percentile': | ||
elif self._glue_name != 'percentile' and isinstance(self.value, (int, float)): |
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.
technically not related to this effort, but a small cleanup that will avoid the isinstance for all cases that aren't percentile.
_wcs_only_label = "_WCS_ONLY" | ||
|
||
|
||
def is_wcs_only(layer): | ||
# exclude WCS-only layers from the layer choices: | ||
if hasattr(layer, 'layer'): | ||
state = layer.layer | ||
elif hasattr(layer, 'data'): | ||
state = layer.data | ||
elif hasattr(layer, 'meta'): | ||
state = layer | ||
else: | ||
raise NotImplementedError | ||
return getattr(state, 'meta', {}).get(_wcs_only_label, False) | ||
|
||
|
||
def is_not_wcs_only(layer): | ||
return not is_wcs_only(layer) | ||
|
||
|
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.
consolidate all this logic in one place and move _wcs_only_label
outside app so that these can be functions instead of methods.
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.
I like all the clean-ups and videos demonstrated the fix. Thanks!
Not sure if you also want to do something about this or not, but it is not related to this PR:
jdaviz/jdaviz/configs/imviz/wcs_utils.py
Line 364 in 54e1691
wcs_only_key="_WCS_ONLY", data=None, |
do you mean defaulting to |
Re: #2699 (comment) As long as Python allows that, I think it is okay to change. I know there are some limitations to class API but this is a function, so should be ok? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2699 +/- ##
==========================================
- Coverage 90.83% 90.81% -0.03%
==========================================
Files 163 163
Lines 21502 21517 +15
==========================================
+ Hits 19532 19541 +9
- Misses 1970 1976 +6 ☔ View full report in Codecov by Sentry. |
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.
The video demo and local testing matches up, and the code changes look good to me!
Description
This pull request filters out the wcs-only subset layer (when linked by WCS in imviz) for the subset visibility toggle as well as in the visibility mixed-state logic in the viewer tabs.
Previously:
Screen.Recording.2024-02-12.at.2.23.20.PM.mov
After this PR:
Screen.Recording.2024-02-12.at.3.07.05.PM.mov
Note that the first click is still showing mixed state - that is a broader bug than the scope of this effort. I did some investigation, and
PlotOptionsSyncState
is requesting that both be updated to be hidden and its not clear where that bug is coming from.Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.