hipspy / hips

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

Introduce class HipsDrawResult in simple.py #91

Closed adl1995 closed 7 years ago

adl1995 commented 7 years ago

As outlined in issue #80, I have added a class HipsDrawResult. This still needs more work, currently it only stores image and geometry.

cdeil commented 7 years ago

This looks good to me. I think you can just continue with this PR for ~ a day, adding more features.

I would suggest adding a __str__ method so that print(result) will print out infos about the result. I've added __repr__ to a few other other classes that do something similar, e.g. HipsTileMeta. Here for the sky image, things that would be good to know are the width and height and number of channels, the dtype of the data, and some info about the WCS geometry.

Another thing I would suggest is to add a write_image method, so that users can do:

result.write_image('image.fits')

and then change the high-level docs example at https://hips.readthedocs.io/en/latest/getting_started.html to call that write_image convenience method instead of the three lines we currently have:

from astropy.io import fits
hdu = fits.PrimaryHDU(data=data, header=geometry.fits_header)
hdu.writeto('my_image.fits')
adl1995 commented 7 years ago

@cdeil I just made these updates. Please review.

adl1995 commented 7 years ago

@cdeil I just pushed my latest code. Now there is a method in HipsDrawResult named plot which plots the all-sky image with HEALPix grid. I also made some changes to the high-level docs and added the __str__ method in WCSGeometry.

cdeil commented 7 years ago

Thanks! (I'll do some small follow-up edits in master later today.)

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.03%) to 97.292% when pulling 821f335f3f6c5ba912bcfdbf2ea55e1d51e6be82 on adl1995:HipsDrawResult into a357718c1ba69e6c41c00334cf285e4489f23e2f on hipspy:master.