Created
March 28, 2017 21:26
-
-
Save barentsen/548f88ef38f645276fccea1481c76fc3 to your computer and use it in GitHub Desktop.
Simple example for conversion from pixel (x,y) to celestial (ra,dec) using astropy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Example conversion from pixel coordinates to ra/dec.""" | |
from astropy.io import fits | |
from astropy.wcs import WCS | |
x, y = 250, 250 | |
f = fits.open('f242_e0_c98.fits') | |
mywcs = WCS(f[0].header) | |
ra, dec = mywcs.all_pix2world([[x, y]], 0)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
x, y = 250, 250 are the length of data in axis 1 and 2 of the fits file?
This script can be applied to fits file with header like this in attach image?
Thanks in advanced for u help, dear.