lpsinger / ligo.skymap

Localization of gravitational-wave transients. Mirror of https://git.ligo.org/lscsoft/ligo.skymap
22 stars 18 forks source link

Issue with Coordinate Transform in Inset #23

Closed rhsharpe closed 1 year ago

rhsharpe commented 1 year ago

Hi!

I am trying to display a fits skymap within an inset on a contour plot (similar to what is shown here: https://lscsoft.docs.ligo.org/ligo.skymap/ but with just the Gemini+F2 plot in the inset). I am having trouble getting the coordinate transforms within the inset to work properly.

If I don't include a transform within the ax_inset.imshow() command, it appears to only show a small corner of the skymap in the inset, which makes sense.

If I use the same transform I used for the skymap plotted in the larger figure (from the header of the fits file) within the ax_inset.imshow() command, the inset is completely blank.

The only way I can get any data to appear in the inset is to use ax.get_transform('pixel'), but then I have the issue of the scale being off.

I've attached examples of the three situations I mentioned. Do you have any suggestions for plotting a fits image, with the correct scaling, as an inset of a healpix contour plot? no_transform header_transform pixel_transform

lpsinger commented 1 year ago

Would you please share your code?

rhsharpe commented 1 year ago

Yes, here is a zip file with my python notebook and the two files I am plotting: skymap.zip

lpsinger commented 1 year ago

Oh, I see. You have to reproject the image data for the zoomed in axes. I suggest using https://reproject.readthedocs.io/en/stable/.