Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reprojection results in nan array #355

Open
Arghya8798 opened this issue Apr 2, 2023 · 3 comments
Open

Reprojection results in nan array #355

Arghya8798 opened this issue Apr 2, 2023 · 3 comments

Comments

@Arghya8798
Copy link

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.

@astrofrog
Copy link
Member

Could you provide an example to reproduce this?

@Arghya8798
Copy link
Author

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.

@svank
Copy link
Contributor

svank commented Nov 20, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants