clean Combine.py add orientat computation from wcs

This commit is contained in:
2024-07-08 17:06:11 +02:00
parent 155717a585
commit 91a59f9664
3 changed files with 37 additions and 32 deletions

View File

@@ -45,3 +45,18 @@ def sci_not(v, err, rnd=1, out=str):
return output[0] + r")e{0}".format(-power)
else:
return *output[1:], -power
def wcs_PA(PC21, PC22):
"""
Return the position angle in degrees to the North direction of a wcs
from the values of coefficient of its transformation matrix.
"""
if (abs(PC21) > abs(PC22)) and (PC21 >= 0):
orient = -np.arccos(PC22) * 180.0 / np.pi
elif (abs(PC21) > abs(PC22)) and (PC21 < 0):
orient = np.arccos(PC22) * 180.0 / np.pi
elif (abs(PC21) < abs(PC22)) and (PC22 >= 0):
orient = np.arccos(PC22) * 180.0 / np.pi
elif (abs(PC21) < abs(PC22)) and (PC22 < 0):
orient = -np.arccos(PC22) * 180.0 / np.pi
return orient