-
Notifications
You must be signed in to change notification settings - Fork 153
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
Implement as_steps in profile layer state #2292
Conversation
* actually binning logic adopted from https://github.com/astropy/specutils/blob/main/specutils/spectra/spectral_axis.py#L42
Nice, I didn't expect it to be as simple, LGTM, also #309 |
Codecov Report
@@ Coverage Diff @@
## main #2292 +/- ##
==========================================
+ Coverage 88.12% 88.14% +0.01%
==========================================
Files 247 247
Lines 23309 23312 +3
==========================================
+ Hits 20541 20548 +7
+ Misses 2768 2764 -4
Continue to review full report at Codecov.
|
As mentioned on Slack, I don't think we want to make these changes here - the Matplotlib viewers already draw things as steps by default so it is really the bqplot layer artist in glue-jupyter which should be updated to include this kind of logic. If we do want to support the option of having both draw styles, then I do support adding a drawstyle or as_steps option to the state, but it should then default to True and simply toggle the drawstyle in the Matplotlib viewer, and again the logic for glue-jupyter should live specifically in the bqplot layer artist (since the Matplotlib layer artist will be taken from glue-core and already draw 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.
Looks good! Just a small comment below about removing unused code.
glue/viewers/profile/state.py
Outdated
@@ -238,6 +240,7 @@ def __init__(self, layer=None, viewer_state=None, **kwargs): | |||
|
|||
self.add_callback('layer', self._on_layer_change, priority=1000) | |||
self.add_callback('visible', self.reset_cache, priority=1000) | |||
#self.add_callback('as_steps', self._on_as_steps_change, priority=1000) |
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.
Remove if unused?
Can you also fix the codestyle failure (run |
b64e85b
to
abae5c6
Compare
Description
This implements a new boolean switch in the profile layer state to toggle displaying the profile as steps vs a line plot.
The actual binning logic is adopted from https://github.com/astropy/specutils/blob/main/specutils/spectra/spectral_axis.py#L42.(binning logic has now been moved to the bqplot artist in glue-viz/glue-jupyter#309)