-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Exploring implementation using Matplotlib as backend #73
Comments
Thank you for your interest! I can't say if mine is the suggested workflow, but personally, I would start with So, in your prototype, instead of Public methods that are not working yet can raise However, optional keyword does not need to exist in your implementation but invoking them also cannot cause error. So a call like @mwcraig or @eteq , feel free to correct me if I am steering @kakirastern in the wrong direction. |
Thanks @pllim for the info! |
This seems like a good way to go. It wouldn't be a bad approach to continue to use ginga to generate the underlying image but then display the image with matplotlib....though I suppose that the classes/functions in astropy.visualization helps quite a bit with converting a raw astronomical image to something displayable by matplotlib. There is a pretty limited implementation of a simple image viewer using matplotlib at https://github.com/mwcraig/ccd-reduction-and-photometry-guide/blob/master/notebooks/convenience_functions.py#L6 https://github.com/mwcraig/ccd-reduction-and-photometry-guide/blob/master/notebooks/convenience_functions.py#L6 motivation for wanting a non-interactive backend like matplotlib is that the API written for the image widget is really convenient for setting up static plots too! |
At one point, outside of notebook, I wrote a script to grab mouse click X & Y locations out of matplotlib imshow. But AFAIK, there is no way to natively have matplotlib then convert X & Y to RA & DEC, so that is something you need to re-implement using https://github.com/pllim/playpen/blob/master/plot_click_example.py (no guarantee that it still works) |
Thanks for the leads, I will definitely follow up on those |
I really like the idea of using Ginga to render directly into a Matplotlib figure, even though support is limited to viewing widget itself. The strength would definitely be in the overplot options. |
BTW, I might as well just call my version of the widget |
Maybe |
Matplotlib is usually shortened to MPL. |
I don't know what is the benefit of using this widget if it requires Ginga anyway. Ginga also can overplot by overlaying its canvas objects. IMHO I would use this if I want publication quality plots without having to install Ginga. Matt, what is the use case that you have in your mind for this implementation? |
Ah, I see... then I will go without Ginga then, just Matplotlib. |
I have try to just use Matplotlib but notice the quality of the image was not as good. |
Hi @michiboo, would it be possible to share a bit of the details about your Matplotlib settings for the displaying of the images? Would like to see if I will get the same qualify with my setup or if I can reproduce the "qualify problem". |
Matplotlib can produce quite good resolution images from my experience... |
If you compare with one produce by Ginga, you can see the difference. |
Okay, thanks @michiboo. I will keep that in mind in case the issue becomes a problem. |
You can set different Matplotlib backends, as with Ginga. By default, I think Ginga uses Qt, while Matplotlib uses TkAgg. If you want, you can play with different backends and see if they make any, well, difference. |
Yup, sounds like some good experimentation to try out... I use |
I think I will try working on this enhancement a bit since I would like to learn about widgets... But I have decided to use astroquery as my GSoC 2019 project idea, since that one is more flexible and I can adjust my workload based on my progress. Turned out a lot of work is needed to develop astroquery a bit more, but help is lacking. And, I see some other potential candidates have already expressed interest in the astrowidgets idea already, so I think it would be better for me to choose something else. That way maybe our collective chances of getting selected will be greater. That's just a guess though, based on my understanding of the situation. |
@kakirastern , you should double check on the official GSoC mailing list for Open Astronomy. I think Open Astronomy only has a limited number of spots. Not all proposed projects will be assigned a participant. Please check over there before making a final decision. |
Okay @pllim, I will give both ideas a try over the next week or so, and see how things go before making a final decision then. |
Hi @pllim, I modified a bit of your matplotlib script to make it work in the tentative
And it is indeed working for on IPython now if I do the following:
At least things are functional for now. Will need to tweak the code some more to make it good. |
Do you mean This is a good start. At some point, the workflow would be something like this: w = MatImageWidget()
w.load_array([[1, 2, 3, 4], [1, 4, 9, 16]])
w # In a notebook, this would display the widget Then on the widget, you can click and have the click do something (like display X and Y in a status bar). Please note that I am not asking you to implement all this immediately, but rather give you the big picture, so you know what implementation is suitable and what is not. Keep up the good work! |
Yup, sure. Now I see... |
And, borrowing @mwcraig's script for show image, if I do the following:
I would get an image like this: I think I will need to tweak the size of the colorbar relative to the figsize a bit so that it will fit the figure size for each setting better, like the one I have shown above. |
Definitely should work on making the widget "pan" and "zoom" very soon... |
Or alternatively I can use my preferred Anyway, for generating the above two plots I am digging the constraints set by the attributes |
I am interested in exploring the development of a non-interactive version using Matplotlib as the backend, towards a non-interactive version which would implement as much of the API as possible in a non-interactive format. However, I have never done anything similar. Is there any suggestions as to some workflow or just simple guidelines I should follow?
The text was updated successfully, but these errors were encountered: