hipspy / hips

Python library to handle HiPS
https://hips.readthedocs.io
13 stars 16 forks source link

Function to compute WCS for a given FITS HIPS tile #17

Open cdeil opened 7 years ago

cdeil commented 7 years ago

@tboch - I see you gave an example of a FITS WCS for a given FITS HIPS tile: https://hips.readthedocs.io/en/latest/drawing_algo.html#wcs-for-fits-tiles

Can you describe how it could be computed for any tile?

Maybe @adl1995 (or you if it's too complex) could add a function (e.g. in hips/utils.py or a new module) that returns such an astropy.wcs.WCS for given HiPS tile parameters?

I think that would be valuable to have, both for debugging and precise tile drawing (e.g. reproject just calls into wcslib via astropy.wcs.WCS, so probably reprojecting a tile with WCS into any other sky image will just work with one call into reproject (and they have the slow flux conserving method also implemented, which is nice).

tboch commented 7 years ago

My colleague François-Xavier provided me with a Java executable to compute this WCS. I know he planned to release his HEALPix-related code under a LGPL licence, I will check if he can already provide me the source code.

cdeil commented 7 years ago

Moving to v0.2 milestone, this isn't urgent. Still, @tboch - any news?

tboch commented 7 years ago

I have the Java source code available. I'll provide a Python version by end of this week. Where should I put this?

cdeil commented 7 years ago

If you have time, you could add this directly to the hips package. Maybe a property or method on https://hips.readthedocs.io/en/latest/api/hips.HipsTileMeta.html would be a good location?

If you want @adl1995 to add it (and add tests / docstring), then you could just put the code you have in a https://gist.github.com/ and then @adl1995 will make a PR adding everything.

cdeil commented 6 years ago

@tboch - Coming back to this: is it really possible to have a WCS for a HiPS tile?

If yes, I think this would be very nice. E.g. one could just use http://reproject.readthedocs.io/ to get a precise tile painting or tile generation if going the other way. And also for debugging, it's very nice to be able to add a WCS and e.g. open a tile in DS9 or check world and pixel coords from Python.

tboch commented 6 years ago

@cdeil : yes, it's possible, I have some working code I still have to properly validate. Should I create a different branch for this?

cdeil commented 6 years ago

Yes, always work in a git branch.

Probably it's a function that makes a WCS or a Header object? Could go here: https://github.com/hipspy/hips/tree/master/hips/utils

If you have an implementation, validating shouldn't be too hard. Pick one or two example tiles and a few pixels in the tile and check their sky position from the WCS against the known sky position from HEALPix.

I don't have much time, but could also try to go back to hipspy a bit in the next weeks and do some things.

cdeil commented 6 years ago

@tboch - Do you have code for a WCS for the HiPS tile? Or should we move this from the v0.3 milestone (in the next weeks) to v1.0 (aka some time in the future)?

tboch commented 5 years ago

thanks to the work of @fxpineau and @bmatthieu3 , I have now a working and validated code (tested with Montage and reproject) to create a WCS for a given HiPS tile: https://gist.github.com/tboch/636913974763f462fb4b51e61e76ee67 It requires cdshealpix package.

Still have to write proper tests, and it will be ready for inclusion in the hips package

cdeil commented 5 years ago

🎉