Closed cdeil closed 8 years ago
Hi Christoph, Toyz does some of this and is able to incorporate the rest, but whether or not I can do it depends a lot on who is willing to offer me a job. I have applied to a number of postdocs and fellowships that would allow me to continue to develop toyz and others that will not. Either way it won't be until after I graduate this summer that I will have time to make any improvements or upgrades. I'll keep you posted as I would love to collaborate on this if I have the opportunity.
The solution I have been using for projects like this (out of necessity) is to generate an image using another library (like matplotlib and wcsaxes), save the image to the server, then use toyz to open the image with tiles (Toyz can open and tile any image supported by the python imaging library). So if you need something now this solution should work for you, but it is a bit cumbersome.
My plan is to integrate toyz into Jupyter, so that a toyz-like interface will be opened in a separate browser tab that can be controlled from Jupyter. This will allow users to manipulate images (such as interpolations, reprojections, etc.), or even use wcsaxes to create an image that can be viewed in toyz. This will also make it easier to integrate with Ginga, which already has a ton of useful widgets. It will also have an R-studio (or spyder) like interface using the open source ACE https://ace.c9.io/#nav=about code editor to edit files or a toyz/Jupyter session from the browser without having to use the notebook interface.
If you'd like to build interactive tools into the toyz viewer I can give you (or a GSoC student) advice about how to do that. I tried my best to make it easy to add new buttons and functions to the control panel so this should be very doable. I have some useful javscript objects that I created, like a multilayer canvas, that might be useful. I don't think webgl will be necessary as you aren't handling a large volume of data and canvas makes it easy to draw on an existing image. One way to do this would be to create a plot using matplotlib, for example a contour plot, and make the background transparent. You could map the tiles of the contour plot to the image and send both to the browser as separate layers (that can easily be hidden using a multilayer canvas) so that they are displayed in the viewer at the same time. For tick marks, the code already keeps track of the world coordinate range in the image, so it would just be a matter of creating a library that wraps the current toyz viewer in a border that updates the tick marks as you scroll. Toyz already has limited support for adding markers of various shapes and sizes but would needs work to make it more interactive and useful.
Cheers, -Fred
On Tue, Jan 5, 2016 at 7:24 AM, Christoph Deil notifications@github.com wrote:
I'm looking for a way to nice astro generate images like what matplotlib + wcsaxes delivers, but in the web browser and interactive.
Does this exist? If no, can we build it?
Desired features:
- Smooth pan and zoom, like what leaflet.js http://leafletjs.com/ provides.
- Maybe even continuous zoom and reprojection like what openlayers does here http://klokantech.github.io/ol3/rasterreproj/final/examples/reprojection.html
- Possibility to deploy as static web page, i.e. JS loads single large images or pre-computed tiles.
- Overplot contours
- Overplot markers / circles that can trigger events.
- Understands FITS WCS (or converters to a web format starting with a FITS input image). visiomatic https://github.com/astromatic/visiomatic has some projections implemented in JS, js9 https://github.com/ericmandel/js9 has a full solution by including WCSLIB via emscripten.
- Overplot ticks and grids, like what wcsaxes does.
Specifically the application we have is for a few mid-sized survey images (10 MB each) like here https://www.mpi-hd.mpg.de/hfm/HESS/pages/home/som/2016/01/ ... I'm not sure if for this the better UX is to fully load all data on page load or load tiles. Ideally I'd like a solution that supports both full images and tiles, so that I can try both.
Would it be best to build this on matplotlib or bokeh https://github.com/bokeh/bokeh or vispy http://vispy.org/ or leaflet.js http://leafletjs.com/ or OpenLayers or something else? Or just on canvas and webgl from scratch? Maybe it's possible to re-implement wcsaxes in JS and have this re-usable for various other projects like JS9, Aladin lite, Visiomatic, ... Anyone interested in collaborating on this in the coming months and / or co-mentoring this or part of the functionality needed as a GSoC 2016 project?
cc @astrofrog https://github.com/astrofrog @mdboom https://github.com/mdboom @ebertin https://github.com/ebertin @ejeschke https://github.com/ejeschke @fred3m https://github.com/fred3m @tboch https://github.com/tboch Pointers? Thoughts?
— Reply to this email directly or view it on GitHub https://github.com/astrofrog/wcsaxes/issues/182.
@cdeil have you tried using the Matplotlib WebAgg backend? (see http://matplotlib.org/users/whats_new.html#webagg-backend)
You can start from the example here:
http://matplotlib.org/examples/user_interfaces/embedding_webagg.html?highlight=webagg
and change create_figure to:
def create_figure():
"""
Creates a simple example figure.
"""
from astropy.wcs import WCS
from wcsaxes.datasets import fetch_msx_hdu
hdu = fetch_msx_hdu()
wcs = WCS(hdu.header)
fig = Figure()
a = fig.add_subplot(111, projection=wcs)
a.imshow(hdu.data)
return fig
At the moment, this raises an exception in WCSAxes due to WCSAxes trying to connect an event - just comment out that line and it should work.
@fred3m - Thanks for the infos about toyz. I looked at http://fred3m.github.io/toyz/viewer.html earlier today. But yea, I want something working ASAP and e.g. http://visiomatic.iap.fr/pleiades/ / Leaflet seems already pretty close to what I want in terms of image display (see https://github.com/astromatic/visiomatic/pull/5#issuecomment-168996546 ... looks like a new version is coming soon).
@astrofrog - Thanks for pointing out Matplotlib WebAgg. I'd much prefer a solution though that can run on a static web server and is responsive like http://visiomatic.iap.fr/pleiades/ . Such smooth pan / zoom can never work if every re-draw happens on the server, right?
As far as I can see no-one has implemented ticks / grids / axis labels / in JS though, i.e. the stuff that wcsaxes / matplotlib do in Python. So maybe it would be worth doing this as a separate JS library that can then be re-used by everyone (e.g. by JS9, toolz, visiomatic, aladin lite, ...)?
I just found this: http://astrojs.github.io/wcsjs/ This is what I had in mind. Looks like it's using d3.geo.graticule.
I'll look around what the existing astro image viewers can do and this specifically tomorrow ...
@kapadia and all -- How come the astronomy web projects at https://github.com/astrojs/ are mostly non-active and Astropy succeeded big time? Is it possible to focus on fewer astro JS packages or complimentary re-usable JS packages?
I find it quite frustrating that there's several nice astro image visualisation projects (JS9, Visiomatic, Aladin Lite, Toyz, ...), but all of them are incomplete (from my point of view, see the whishlist in the original comment above).
I'll definitely try to contribute something in 2016 ... been reading "JavaScript: the good parts" over the Christmas break ... but where? :-)
@cdeil - have you tried using the nbagg
backend in the IPython notebook? I wonder if it could just be used outside the nb?
@astrofrog - nbagg
also needs a Python process, no?
I want something that can be deployed as a static web page.
I've started this today to try to build what I want with different JS libraries: https://github.com/cdeil/slippy-astro-images Once I have some working demos I'll drop a note here.
@cdeil - yes sorry, I re-read the whole thread, indeed those need a Python server. I wonder if it would make sense to ask Thomas Boch if he has coordinate graticules planned for Aladin Lite, since if so it seems it would go a long way towards what you need?
There's no graticules in Aladin Lite: https://github.com/cdeil/AladinLite/search?utf8=%E2%9C%93&q=graticule
And it's 10k lines of JS, not re-using any existing projects (such as wcsjs, d3, leaflet, openlayers, ...) and it's GPL licensed (because it uses code derived from HEALPIX) and not open development (only tarball available).
So for now I'm trying to put together something based on various combinations of wcsjs, visiomatic, leaflet, proj4, openlayers, d3. Graticules are not super-important for my webpage, but they aren't hard to do with d3.
I don't know if this will lead to something useful, at the moment it's just experimentation at https://github.com/cdeil/slippy-astro-images. Long-term I think https://github.com/astrojs as a set of separate, re-usable astro JS libraries is the right approach. Unfortunately it looks like it's dead.
Hi Christoph and all,
Aladin Lite (AL) currently provides part of your requested features :
As I told you privately, I'm fully aware of the limitations of the current GPL licence (imposed by my HEALPix JS code derived from the official HEALPix Java library). I know that @astrofrog has had similar problems with his Python reproject library. On a side note: has anyone tried to approach HEALPix authors to let them know of this issue? It would be so much easier if it had a BSD-like licence.
The AL project will move to github and will be managed from there.
@tboch - Thanks for the infos.
I realise my last comment was overly negative on Aladin Lite, sorry for that!
I'm still very interested in Aladin Lite and plan to try it out tomorrow for my simple example: https://github.com/cdeil/slippy-astro-images#aladin-lite
For the coming weeks, I'd also be interested to work on Python scripts to prepare data in HIPS format or contours in a format that works, or to extend Aladin Lite (or one of the other solutions) to work with non-HIPS images (i.e. single PNGs or tiles or FITS directly).
If you can make the move to Github for AL happen soon, that would be great!
@tboch - thanks for commenting on this! Regarding the HEALPIX license, @demitri pointed me to this discussion he had a little while ago with the HEALPIX devs:
http://sourceforge.net/p/healpix/mailman/message/34593601/
and it seems they might be open to re-licensing the core transformation part of the code.
@demitri - any updates?
There is... still resistance to this idea. While not dead, Martin suggested a faster path may be to port this Julia library to C:
https://github.com/ziotom78/Healpix.jl
I have a need an open source C implementation of HEALPix, but it's not a pressing priority - I need to get Nightlight out first. Happy to work with someone if there is interest in this port, but in a more medium-term time frame. This would involve learning Julia (which I don't have time for at the moment). Anyone know anyone who knows Julia & C who could bang this out quickly? I'd be happy to help clean up/organize a working C translation.
Martin Reinecke tells me that anyone who is interested in a basic HEALPix library under a more liberal license should register their interest on the HEALPix support mailing list. Right now it looks like it's just me. This would help support those who are in favor of this. The HEALPix support mailing list is here:
https://lists.sourceforge.net/lists/listinfo/healpix-support
I'm going to go ahead and close this, since there are no action items for WCSAxes (I'm starting to try and prepare WCSAxes for merging into astropy, so I'm making sure as many issues as possible are closed first)
I'm looking for a way to nice astro generate images like what matplotlib + wcsaxes delivers, but in the web browser and interactive.
Does this exist? If no, can we build it?
Desired features:
Specifically the application we have is for a few mid-sized survey images (10 MB each) like here ... I'm not sure if for this the better UX is to fully load all data on page load or load tiles. Ideally I'd like a solution that supports both full images and tiles, so that I can try both.
Would it be best to build this on matplotlib or bokeh or vispy or leaflet.js or OpenLayers or something else? Or just on canvas and webgl from scratch? Maybe it's possible to re-implement wcsaxes in JS and have this re-usable for various other projects like JS9, Aladin lite, Visiomatic, ... Anyone interested in collaborating on this in the coming months and / or co-mentoring this or part of the functionality needed as a GSoC 2016 project?
cc @astrofrog @mdboom @ebertin @ejeschke @fred3m @tboch Pointers? Thoughts?