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

Bug in backward_transform #511

Open
izkgao opened this issue Sep 13, 2024 · 0 comments
Open

Bug in backward_transform #511

izkgao opened this issue Sep 13, 2024 · 0 comments

Comments

@izkgao
Copy link

izkgao commented Sep 13, 2024

I tried to check if a coordinate is inside a WCS (jw01837003010_04201_00001_nrcblong, after TweakReg), but it gives a wrong result, while the astropy fits wcs converted from gwcs gives the correct result.

import asdf
from astropy.wcs import WCS

with asdf.open('test.asdf') as af:
    wcs = af.tree['wcs']

print(wcs.in_image(150.200, 2.210))
# True
fits_wcs = WCS(wcs.to_fits_sip())
print(fits_wcs.footprint_contains(SkyCoord(ra=150.200, dec=2.210, unit='deg')))
# False

print(wcs.backward_transform(150.200, 2.210))
# (763.3177190034882, 595.2616574347967)
print(wcs.forward_transform(*wcs.backward_transform(150.200, 2.210)))
# (150.108379118644, 2.3911705306532)

test.asdf.zip

The four blue points are the footprint, and the orange point is the target, which is outside the footprint.

image

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

1 participant