-
Notifications
You must be signed in to change notification settings - Fork 74
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
Plugin plots to viewers #2498
Plugin plots to viewers #2498
Conversation
6fb5665
to
f253e13
Compare
Is this the one that segfaults with fast-histogram? Should I hold off on reviewing? |
It is, but I am quite sure that is an upstream bug (that will need to be addressed before merging). If it doesn't segfault for you, then I think its ready for reviewing! And if it does - the code can still be reviewed. We also need to make decisions on the other "bugs" in the histogram viewer and whether those block merge or not, given that we want to build on top of this very soon. |
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 also got the segfault like CI and Ricky, so I cannot run the code, but I left some general comments.
jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py
Outdated
Show resolved
Hide resolved
@@ -58,6 +64,14 @@ | |||
SPATIAL_DEFAULT_TEXT = "Entire Cube" | |||
GLUE_STATES_WITH_HELPERS = ('size_att', 'cmap_att') | |||
|
|||
# this histogram viewer (along with other viewers) are not in the glue viewer-registry by default | |||
# but may be added in the future. If it is not in the registry, we'll add it now. If/once the | |||
# min-pin of glue-jupyter includes this in the registry, we can safely remove this block. |
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.
What is the glue-jupyter PR that would include this upstream?
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.
Nothing yet, I've asked if it is intentionally excluded and if it isn't I'll open a PR there.
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.
2fc6de6
to
5c4956f
Compare
5c4956f
to
55a658c
Compare
We now have a workaround (with guardrails) for the segfault. This should now be ready for review - please read the description as well as in-line comments about known issues and current workarounds before testing! |
This is pretty cool, I like it more than I thought I would. That said, I've encountered two issues. The first is that in the histogram viewer, the stretch curve does not seem to update based on panning and zooming correctly: Screen.Recording.2023-10-09.at.9.42.44.AM.movAnd the second is that nothing plots for me in the line profile plugin: Screen.Recording.2023-10-09.at.9.50.29.AM.movI took a cursory read through the code changes and nothing egregious stood out to me, but I'll try to take a closer look before actually approving. I figured I'd bring these bugs up now though. |
This is by-design (but can be debated if it's what we want). The stretch function is not in the same units as the y-axis of the histogram, and so is essentially tied to a separate, normalized, y-axis. I thought about only allowing horizontal pan/zooming to avoid any confusion here, but I think it is useful to be able to zoom vertically on the tail of the histogram as well.
hmmm, I can't reproduce that 🤔 Does something show if you press the home button? Right now I don't reset zoom on a change to the requested pixel, but we easily could. The downside would be if the user intentionally zooms and wants to keep that zoom when changing between pixels, but maybe we should instead have an option to lock that as a follow-up effort? EDIT: the plots now reset by default, if we ever want to disable that, we can add a toggle to lock the limits when data changes. |
Codecov ReportAttention:
... and 1 file with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
Nope, nothing. 👍 on the histogram, maybe demo that offline at the review today and get feedback? I don't think it's super important but could potentially be confusing. |
Bizarre, can you dig into the object itself and see if the arrays are populated as expected?
|
Some feedback from review: this probably makes sense as-is for now, but we might need to reconsider when adding support for custom/interactive splines. The orange vertical line for vmin/vmax also looks like its a bug, so a different color might help (that we can do when making them interactive as well). |
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.
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.
Works for me now, code looks fine. Let's get this in so we can iterate on it.
Ok, please hold off on merging for a bit - I'll merge aperture photometry first since that should be an easier order for the rebase 🤞 |
* downsampling no longer necessary * lose logic to ensure vmin/max markers are within viewer range (might be confusing) * home button on histogram viewer is buggy
* not currently implemented for histogram since that can break the plot
* invert toolbar in dark mode * connect lines when applicable in radial profile * sci notation on y-axis for line profile and radial profile * set number of ticks for line profile
restored from 5caefde Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
efc9c32
to
5ba0a6f
Compare
* create separate app instance with glue-viewer * nested toolbar in plugin viewers * migrate implementation for scatter viewers (radial profile, line profiles) and histogram (stretch in plot options) * downsampling no longer necessary * lose logic to ensure vmin/max markers are within viewer range (might be confusing) * home button on histogram viewer is buggy * update tests * temporary workaround to segfault on some machines * bump glue-jupyter to ensure scatter lines support
Description
This pull request migrates all plugin plots (plot options stretch histogram, imviz's line profile, imviz's aperture photometry radial profile) to use a glue-viewer object, with their own independent app instances, instead of a bqplot object. This then allows us to use our nested toolbar on these plots (note that the data are not linked to the main data-collection, so using subset tools probably doesn't make sense). This is left somewhat flexible so that we can share the app instance when it makes sense - possibly for the compass plugin in the future.
For the stretch histogram, this removes the need for downsampling, but also loses the logic for ensuring the vmin/vmax markers are visible (since the limit state is handled by the viewer directly and the user can override - whereas previously the limits were fixed by code in the plugin).
Note that the histogram implementation includes some hacky workarounds due to bugs upstream. I'll work on reporting those and we can create tech debt tickets to remove the workarounds. The home button on the histogram is also known to be broken - we can either live with that until there is an upstream fix, remove the home button for the histogram in this PR, or block merging this PR until there is an upstream fix.
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.