I have icrs coordinates(SkyCoord) of two sources. Using astropy directional_offset_by() method I have found position angle and separation between them.
So when I add this position angle and separation to the first Skycoord I should get the second SkyCoord, and I did.
But when I try to get the first SkyCoord from the second source, I get different results.
Separation should be the same, but the position angle should be rotated by 180 deg, right?
I am missing something obvious but can't see what.
I put below minimum working example.
Alpheratz = SkyCoord.from_name('Alpheratz')
Peg = SkyCoord.from_name("Psi Pegasi")
Pos_ang = Alpheratz.position_angle(Peg)
Sep = Alpheratz.separation(Peg)
print("Pos_ang:",Pos_ang,"Sep:", Sep)
Peg_from_A = Alpheratz.directional_offset_by(position_angle = Pos_ang, separation = Sep)
Alphe_back_from_Peg = Peg_from_A.directional_offset_by(position_angle = Pos_ang - 180*u.deg, separation = Sep)
print("Peg from name:",Peg,"\nPeg from A:", Peg_from_A)
print("Alphe from Name:", Alpheratz, "\nAlphe back from P from A", Alphe_back_from_Peg)