hipspy / hips

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

Unable to image using fits-based HiPS #150

Closed epaell closed 3 years ago

epaell commented 3 years ago

In the past I was able to fetch data from a FITS-based HiPS and make images. The fetch still appears to work but the call to make_sky_image results in the following error:

./test1.py Fetching tiles: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 138/138 [00:26<00:00, 5.13it/s] Drawing tiles: 0%| | 0/552 [00:00<?, ?it/s] Traceback (most recent call last): File "./test1.py", line 12, in <module> result = make_sky_image(geometry, hips_survey, 'fits', precise=True) File "/Users/len067/miniconda3/lib/python3.8/site-packages/hips/draw/ui.py", line 46, in make_sky_image painter.run() File "/Users/len067/miniconda3/lib/python3.8/site-packages/hips/draw/paint.py", line 153, in run self.draw_all_tiles() File "/Users/len067/miniconda3/lib/python3.8/site-packages/hips/draw/paint.py", line 200, in draw_all_tiles tile_image = self.warp_image(tile) File "/Users/len067/miniconda3/lib/python3.8/site-packages/hips/draw/paint.py", line 138, in warp_image return warp( File "/Users/len067/miniconda3/lib/python3.8/site-packages/skimage/transform/_warps.py", line 877, in warp warped = _warp_fast[ctype](image, matrix, File "skimage/transform/_warps_cy.pyx", line 71, in skimage.transform._warps_cy._warp_fast ValueError: Big-endian buffer not supported on little-endian compiler

A minimal code to reproduce the above is: `

!/usr/bin/env python

from astropy.coordinates import SkyCoord from astropy.coordinates import Angle from astropy import units as au from hips import WCSGeometry from hips import HipsSurveyProperties from hips import make_sky_image

coord = SkyCoord(Angle(303.74380308, unit=au.deg), Angle(-56.25561379, unit=au.deg), frame='fk5') hips_survey = HipsSurveyProperties.fetch('https://www.atnf.csiro.au/research/RACS/RACS_I1/properties') geometry = WCSGeometry.create(skydir=coord, width=3840, height=2160, fov="3.2 deg", coordsys='icrs', projection='SIN') result = make_sky_image(geometry, hips_survey, 'fits', precise=True) `

If I change 'fits' to 'png' then it seems to work fine.

I have hips installed via conda and I seem to encounter this issue on several systems where I have this installed (Mac and Linux). It makes me wonder whether there has been some incompatibility introduced in one of the underlying libraries/packages?

adl1995 commented 3 years ago

Fixed by @lpsinger in #151. Thanks!

epaell commented 3 years ago

Great - thanks!