reproject icon indicating copy to clipboard operation
reproject copied to clipboard

Reprojection results in nan array

Open Arghya8798 opened this issue 1 year ago • 3 comments

I have been trying to reproject DECaLS (fk5) data to SDSS (ICRS) data but either way it results in a matrix with all nan values with no error. I dont know what I am doing wrong or if its a limitation with reproject.

Arghya8798 avatar Apr 02 '23 11:04 Arghya8798

Could you provide an example to reproduce this?

astrofrog avatar Apr 02 '23 17:04 astrofrog

https://drive.google.com/drive/folders/1pEhdBSjhjnyzQwmpYtV9nplC3aoN2ukY?usp=sharing

You can find two example fits files here. If you simply use these 2 to reproject using any method ( interp, exact etc.) it will give you a nan matrix. The Residue is DECaLS data and the other image is SDSS.

Arghya8798 avatar Apr 02 '23 19:04 Arghya8798

I just took a quick peek at this---are you reprojecting one image into the frame of the other? It looks like the two images don't have any overlap, so there won't be anything in the output after that type of reprojection.

f1 = '/home/svankooten/Downloads/drive-download-20231120T175030Z-001/arprcutout5752masked.fits'
f2 = '/home/svankooten/Downloads/drive-download-20231120T175030Z-001/DecalsResiduecutout.fits'
d1, h1 = fits.getdata(f1, header=True)
d2, h2 = fits.getdata(f2, header=True)
plt.figure(figsize=(10,5))
plt.subplot(121, projection=WCS(h1))
plt.imshow(d1)
plt.subplot(122, projection=WCS(h2))
plt.imshow(d2)
plt.tight_layout()

image

If I reproject the Decals data into the frame of arprcutout5752masked.fits and extend the output array, you can sort of see where the two images are positioned relative to each other:

r = reproject.reproject_adaptive((d1, h1), WCS(h2), shape_out=(500, 4500), return_footprint=False)
plt.figure(figsize=(10,5))
plt.subplot(111, projection=WCS(h2))
plt.imshow(d2)
plt.imshow(r)

image You can see the Decals image is way off to the side, and so simply reprojecting it into the other image's frame (or vice versa) with reproject.reproject_interp((d1, h1), h2) won't show anything. I'm not at all familiar with these data sources---if these two images are supposed to be of the same object, one of them might have incorrect data in the FITS header.

svank avatar Nov 20 '23 18:11 svank