glue-jupyter icon indicating copy to clipboard operation
glue-jupyter copied to clipboard

Implement world coordinate display in bqplot image viewer

Open astrofrog opened this issue 5 years ago • 7 comments

Currently the Matplotlib image viewer uses WCSAxes to display world coordinates. There are two parts to this:

  • [ ] Generalize some of the code in WCSAxes in Astropy to not be Matplotlib-dependent (see https://github.com/astropy/astropy/issues/9993). This would provide the tick positions, labels, and axis labels to show on each axis.
  • [ ] Given the tick positions, labels, and axis labels, draw these in the correct location in bqplot

@maartenbreddels - since you have experience with bqplot, do you think there is a way to disable the default ticks/tick labels and plot ticks and tick labels at custom locations instead?

astrofrog avatar Mar 03 '20 14:03 astrofrog

Yes, location we can control, using bqplot's Axes object has a tick_values. But we don't have a way to control the tick label, only via a formatter. I guess we can open an issue at bqplot, and I could work on that.

maartenbreddels avatar Mar 03 '20 14:03 maartenbreddels

@maartenbreddels - yes having the ability to use a custom formatter would be great - and ideally we would then want to use the WCSAxes one, maybe with a thin wrapper if needed. Based on discussions with @eteq I'm pretty sure that this issue is reasonably high priority so it might indeed make sense if you can work on that part. I can work on generalizing the WCSAxes code so that I can provide bqplot with a list of ticks and tick labels.

Do you think it's something we can develop as a patch to bqplot in a separate package (in the short term), or is it something that would require internal changes in bqplot?

astrofrog avatar Mar 03 '20 14:03 astrofrog

I just discussed this a bit more with @astrofrog, and I think the second of these check box is the higher priority, because it might be better in at least some views to hide the ticks/axis labels entirely.

Of course that still requires the "tick finding" logic, so maybe all the work is needed anyway even if we hide the axes (while showing the overlay grid lines). @maartenbreddels perhaps has a guess at that?

eteq avatar Mar 03 '20 16:03 eteq

I'll keep both options in mind. Would it make sense to have an axis object that is wcs aware, or do you want to handle it all in the kernel?

maartenbreddels avatar Mar 03 '20 18:03 maartenbreddels

I don't think we could handle WCS in a generic way in the frontend, we'd need to be able to support FITS-WCS, GWCS, and so on (any APE-14-compliant WCS).

astrofrog avatar Mar 04 '20 09:03 astrofrog

One option for this, to at least have something working, would be to see if we can somehow internally store a WCSAxes instance that can be used to determine the ticks and tick labels, and then use the new bqplot functionality to override these in order to set them in the front-end.

astrofrog avatar May 16 '24 13:05 astrofrog

I've opened https://github.com/astropy/astropy/issues/16464 to see how we can facilitate this on the WCSAxes side.

astrofrog avatar May 16 '24 13:05 astrofrog