diff --git a/docs/getting_started.rst b/docs/getting_started.rst index ac958e1..d59a8c7 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -37,20 +37,18 @@ To make a sky image with the `hips` package, follow the following three steps: 3. Call the `~hips.make_sky_image` function to fetch the HiPS data - and draw it, returning the sky image pixel data as a Numpy array:: + and draw it, returning an object of `~hips.HipsDrawResult`:: from hips import make_sky_image - data = make_sky_image(geometry, hips_survey, 'fits') + result = make_sky_image(geometry, hips_survey, 'fits') That's it. Go ahead and try it out for your favourite sky region and survey. Now you can then save the sky image to local disk e.g. FITS file format:: - from astropy.io import fits - hdu = fits.PrimaryHDU(data=data, header=geometry.fits_header) - hdu.writeto('my_image.fits') + result.write_image('my_image.fits') or plot and analyse the sky image however you like. diff --git a/hips/draw/simple.py b/hips/draw/simple.py index 2539df3..d53e408 100644 --- a/hips/draw/simple.py +++ b/hips/draw/simple.py @@ -219,7 +219,7 @@ def write_image(self, filename: str) -> None: Filename """ if self.tile_format == 'fits': - hdu = fits.PrimaryHDU(self.image) + hdu = fits.PrimaryHDU(data=self.image, header=self.geometry.fits_header) hdu.writeto(filename) else: image = Image.fromarray(self.image) diff --git a/hips/draw/tests/test_simple.py b/hips/draw/tests/test_simple.py index d038f43..5fc5a1a 100644 --- a/hips/draw/tests/test_simple.py +++ b/hips/draw/tests/test_simple.py @@ -55,7 +55,7 @@ def test_make_sky_image(pars): assert_allclose(np.sum(result.image), pars['data_sum']) assert_allclose(result.image[200, 994], pars['data_1']) assert_allclose(result.image[200, 995], pars['data_2']) - # result.write_image('test.' + pars['file_format']) + result.write_image('test.' + pars['file_format']) assert repr(result) == pars['repr'] @remote_data