-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
future-proof slicing logic for glue-jupyter as_steps support #1599
Conversation
jdaviz/configs/cubeviz/helper.py
Outdated
x_all = self.app.get_viewer('spectrum-viewer').native_marks[0].x | ||
sv = self.app.get_viewer('spectrum-viewer') | ||
x_all = sv.native_marks[0].x | ||
if sv.state.layers[0].as_steps and GLUEJUPYTER_HAS_AS_STEPS: |
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 these two clauses need to be in the opposite order to avoid an error if as_steps
isn't present?
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.
as_steps
is present in the layer state as of glue 1.3.0 (and we require 1.5.0). But before glue-jupyter 309 is released, it does nothing within bqplot (and so the length does NOT double if someone manually changes the state of as_steps
to True).
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.
Got it. I'll test shortly.
jdaviz/configs/cubeviz/helper.py
Outdated
from jdaviz.core.helpers import ImageConfigHelper | ||
from jdaviz.configs.default.plugins.line_lists.line_list_mixin import LineListMixin | ||
from jdaviz.configs.specviz import Specviz | ||
from jdaviz.core.events import (AddDataMessage, | ||
SliceSelectSliceMessage) | ||
|
||
# NOTE: this and the if-statement that uses it can be removed if/once | ||
# the version of glue-jupyter with as_steps support is pinned as min-version | ||
GLUEJUPYTER_HAS_AS_STEPS = Version(gj_version) >= Version('1.3.0') |
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.
to test this, install glue-viz/glue-jupyter#309 locally and change GLUEJUPYTER_HAS_AS_STEPS
to True
(since the version check won't actually resolve to True until 309 is merged and released).
Codecov Report
@@ Coverage Diff @@
## main #1599 +/- ##
==========================================
- Coverage 86.12% 86.12% -0.01%
==========================================
Files 94 94
Lines 9321 9326 +5
==========================================
+ Hits 8028 8032 +4
- Misses 1293 1294 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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 confirmed that setting GLUEJUPYTER_HAS_AS_STEPS
to True
fixes the slicing behavior with the glue-jupyter
PR that implements histogram-style plotting. Approved.
@@ -39,6 +39,8 @@ Bug Fixes | |||
Cubeviz | |||
^^^^^^^ | |||
|
|||
- Future proof slicing logic for as_steps implementation in upcoming glue-jupyter release. [#1599] |
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 am not sure if this needs a change log. User is not impacted yet, so this might just confuse them.
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 wasn't sure where to put this, but my thinking was that jdaviz 2.9 (the latest release) will break for anyone who updates glue-jupyter to 1.3 0.13 (once that is released)... so it will become a bugfix to 2.9 once that happens. If someone stays on 2.9, updates glue-jupyter, and sees the break, then maybe this entry will tell them that an update to 2.10 will fix their problem? But I also see your point, that at the time 2.10 is released, the bug doesn't actually exist yet.
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.
Maybe more visible as a known issue entry then? "If you have this version but upgraded that package, this thing will break" under the Installation section.
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.
except we can't go back and add that to the 2.9 docs afaik, which is where it would be really useful. In the future, especially once we pin glue-jupyter, that entry in the stable docs will be irrelevant.
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 think our RTD defaults to latest
, not stable
.
But if you insist on the change log, then that is fine too. Mine was merely a suggestion.
I attempted to review but am wondering if I'm missing something about |
@ojustino - you'll need to install my |
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 tested two ways:
- I pulled this branch and used
pip install -e .
to install its version ofjdaviz
in a new conda environment. That gave meglue-jupyter
v0.12.0, which should trigger theFalse
case of the newif
statement. - I used
pip install git+https://github.com/kecnry/glue-jupyter.git@profile-viewer-as-steps
to install the indicated version ofglue-jupyter
, which appears for me as v0.10.2.dev.... (and so on). Since theglue-jupyter
version number decreased, I changed theminversion
check to v0.10 in order to trigger theTrue
case of the newif
statement.
I didn't have a problem with slicing in Cubeviz either way, so I am OK approving since the code looks fine and it would be useful for others to get the release out soon.
glue-viz/glue-jupyter#309 is now merged into main, and is causing CI to fail for the dev case. That's just because its not triggering the minversion check and so is essentially just exposing the bug if this isn't in place. Once that gets tagged as 0.13, local tests show that this should do the trick 🤞 |
Thanks for the quick fix! |
and revert version check from spacetelescope#1599
to cover if-statement introduced in spacetelescope#1599
and revert version check from spacetelescope#1599
to cover if-statement introduced in spacetelescope#1599
* plot options switch for as_steps * for data layers, defaults to False, for subset layers: default to as_steps option on parent data layer (when subset layer is created) * internal uncertainty styling to obey "as steps" * bump glue-jupyter to 0.13 * add slice tests to cover if-statement introduced in #1599
Description
This pull request future-proofs the slicing wavelength to slice logic for when a future release of glue-jupyter includes glue-viz/glue-jupyter#309. That PR, when
layer.as_steps=True
, doubles the length of the bqplot Lines object, which has been used since #1550 to quickly access the wavelength array to map wavelength to slice.I suspect this will fail coverage, as we have no way within CI to force entering that if-statement. Covering the if-statement within CI should probably be added to #1595 (I added a TODO entry there to make sure that is done once that is rebased on top of this).
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.CHANGES.rst
?