Open alexw-im opened 11 months ago
Hi @alexw-im,
The rotation is, in a sense, part of the WCS object. However, there is no simple way to extract it (to my knowledge) because Astrometry.net generates a CD matrix (details at https://docs.astropy.org/en/stable/wcs/index.html and https://arxiv.org/abs/astro-ph/0207407). In a nutshell, the CD matrix is a general linear transformation (not just scale + rotation but also shear), which makes the notion of field rotation ill-defined.
I can think of two workarounds:
solution.best_match().astropy_wcs().wcs.cd
) by the square root of its determinant, pretend that the result is roughly a rotation matrix, and calculate the rotation value with arcsin and/or arcos (https://en.wikipedia.org/wiki/Rotation_matrix).Hi, Once you have solved the WCS, you should be able to extract it using the wcs matrix. From https://danmoser.github.io/notes/gai_fits-imgs.html:
CD1_1 = CDELT1 cos (CROTA2) CD1_2 = -CDELT2 sin (CROTA2) CD2_1 = CDELT1 sin (CROTA2) CD2_2 = CDELT2 cos (CROTA2)
The 1996 proposed FITS WCS standard used PC001001, PC001002, PC002001, and PC002002 to represent the rotation matrix but retained CDELT1 and CDELT2 for the scale. It is also read by this software, but should not be used for new WCS's.
I can confirm that the WCS produced has the PC_* keywords and you can obtain the angle with the arctan of the ratio of the values.
Our you can use local_partial_pixel_derivatives to get the angle in any part of the image (probably better).
It looks like the
Match
object includes center RA and Dec but not rotation to north about the frame center. I guess that's probably provided in the attached WCS? If so, I can't find it. Any pointers where to go looking?