-
Notifications
You must be signed in to change notification settings - Fork 76
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
Export plugin plots #2774
Export plugin plots #2774
Conversation
I don't want to be human! I want to see gamma rays! (A special day message.) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2774 +/- ##
==========================================
+ Coverage 88.72% 88.93% +0.20%
==========================================
Files 110 110
Lines 16353 16473 +120
==========================================
+ Hits 14509 14650 +141
+ Misses 1844 1823 -21 ☔ View full report in Codecov by Sentry. |
(whoops sorry i pressed close with comment instead of comment) |
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.
LGTM - thanks!
This might be only on my end. I see a success message for export |
Try restarting the kernel? This was happening for me occasionally |
This might be susceptible to the same problems as the viewer exporting as its using the same internals. We'll just have to live what that for now, I think |
I can't confirm at this point if it works as it should, as clearing the cache, restarting the kernel, and reinstalling the branch didn't solve the problem on my end. |
@haticekaratay does exporting other items work, is it just the plots that are not working? |
Yes, I can export other items. I guess we can merge it as both you and @kecnry confirms that it works. Or another dev might look into it. |
I also don't see where the PNG file ends up - I'm trying to rebase on top of #2782 to see if that fixes it, but the rebase is more painful than I expected and I'm out of time tonight. I'll try to continue in the morning. |
i think i have a hunch about what is going on. What i first noticed was that the stretch histogram is not actually populated with meaningful values until plot_options is opened. If you open the data analysis plugins from the icon not in the viewer, plot_options doesn't open automatically, so the histogram is 'empty'. Once you open that plugin and the histogram is fully created, you should be able to export. This is why I was seeing it working and others weren't - I was able to export stretch_histogram because I opened the plugin tools from the viewer, which automatically opens plot_options. This isn't the exact reason though - it's not because the histogram is 'empty' that it won't save, there is something about opening it and rendering it for display that allows it to be saved, and if plot options isn't opened first, this doesn't happen. If the histogram were truly 'empty', it wouldn't appear in the export plugin as available for export at all (the filter that is done for plugin plot select checks figure.marks, and in this case it isn't actually empty even though the values don't reflect the data until the plugin is opened). The fact that plot_options isn't opened automatically to render the figure for display before trying to export it is what is causing it to fail when exporting, I think. You can try this programmatically too - the plugin plot _obj is able to be inspected but not saved until you actually display in in the notebook. |
This is caused by the same thing that causes the viewers to fail to export until the app is rendered 🐱. I tried wrapping the call with |
Unfortunately (for that theory) I wasn't trying to save out the plot options histogram, I had run aperture photometry to make a curve of growth plot and was trying to save that, so it was definitely populated. |
Also, this might need a rebase to main - I see a bunch of commits from Hatice that I assume aren't supposed to be here. Unless this was building off something else that wasn't merged in addition to Kyle's WIP. |
See cshanahan1#1 for a proposed "solution"/workaround. |
I was working off Kyle's WIP branch which was working off Hatice's WIP branch. I merged main into my branch yesterday too, so maybe that's it. Git history confuses me... |
Ok so I was able to reproduce this, but then refreshing the kernel made the issue go away. Then i refreshed a few more times and it happened again. I can't figure out why it fails only sometimes for me. Does it always fail to export for you? |
It does seem to happen though consistently when I close the aperture photometry plugin, so hopefully Kyle's PR should fix that |
Ahh yes that's it, I confirmed that if I close the aperture photometry plugin the export of the plot fails. If it's open, the save dialog appears as expected. |
render selected plot for export offscreen
Sorry, I just realized the failing test. Approved to be merged after a fix to that. |
Add ability to export plots from various plugins through export plugin.
@kecnry did much of this, and the changes I made on top of his are:
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.