Created
November 4, 2019 22:01
-
-
Save cbassa/48202f4c1990831336232ffa4d1788f4 to your computer and use it in GitHub Desktop.
FITS WCS rotation angles
This file contains hidden or 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
#!/usr/bin/env python3 | |
import sys | |
import numpy as np | |
from astropy.wcs import wcs | |
w = wcs.WCS(sys.argv[1]) | |
sx = np.sqrt(w.wcs.cd[0, 0]**2+w.wcs.cd[0, 1]**2)*3600.0 | |
sy = np.sqrt(w.wcs.cd[1, 0]**2+w.wcs.cd[1, 1]**2)*3600.0 | |
ang1 = np.arctan2(w.wcs.cd[0, 1], w.wcs.cd[0, 0])*180.0/np.pi | |
ang2 = np.arctan2(-w.wcs.cd[1, 0], w.wcs.cd[1, 1])*180.0/np.pi | |
print("scale: %gx%g arcsec, rotation: %g, %g deg" %(sx, sy, ang1, ang2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment