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

Hover spectrum with extra axis #2661

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Jan 16, 2024

This is a follow up to #2647 that would overlay the preview spectrum on whatever the current zoom is, with an additional y-axis on the right to show the flux of the preview spectrum. Currently blocked by a potential bqplot bug, where the axis tick values are not updating when the axis scale updates.

@rosteen rosteen added this to the 3.9 milestone Jan 16, 2024
@github-actions github-actions bot added documentation Explanation of code and concepts cubeviz plugin Label for plugins common to multiple configurations labels Jan 16, 2024
@rosteen rosteen added 💤 enhancement New feature or request and removed documentation Explanation of code and concepts plugin Label for plugins common to multiple configurations labels Jan 16, 2024
Copy link
Collaborator

@maartenbreddels maartenbreddels left a comment

Choose a reason for hiding this comment

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

Added some suggestions i came up with while working on this, and
bqplot/bqplot#1638
should fix the issue you mentioned.

Comment on lines +181 to +182
self._extra_axis.send_state(["scale", "visible"])
self._spectrum_viewer.figure.send_state(["fig_margin", "axes"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

These shouldn't be needed, maybe axes because you mutate them.

#self._reset_spectrum_viewer_bounds()
# Fully remove the extra axis rather than just setting to invisible
if self._extra_axis in self._spectrum_viewer.figure.axes:
self._spectrum_viewer.figure.axes.remove(self._extra_axis)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self._spectrum_viewer.figure.axes.remove(self._extra_axis)
axes = self._spectrum_viewer.figure.axes.copy()
axes.remove(self._extra_axis)
self._spectrum_viewer.figure.axes = axes

mutations are not detected

self._spectrum_viewer = self.viewer.jdaviz_helper.app.get_viewer('spectrum-viewer')
# Add extra y-axis to show on right hand side of spectrum viewer
if self._extra_axis not in self._spectrum_viewer.figure.axes:
self._spectrum_viewer.figure.axes.append(self._extra_axis)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self._spectrum_viewer.figure.axes.append(self._extra_axis)
self._spectrum_viewer.figure.axes = [*self._spectrum_viewer.figure.axes, self._extra_axis]

mutations are not detected

self._mark.visible = True
y_values = spectrum.flux[x, y, :]
if np.all(np.isnan(y_values)):
self._mark.visible = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

While trying to reproduce the bug in bqplot I noticed this resulted in my axis not being visible most of the time, maybe the test in the line above is faulty?

@gibsongreen gibsongreen modified the milestones: 3.9, 3.10 Apr 5, 2024
@bmorris3 bmorris3 modified the milestones: 3.10, 3.11 May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubeviz 💤 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants