Repository navigation
Closed
Labels
Close?Tell stale bot that this issue/PR is staleTell stale bot that this issue/PR is stalecoordinatesquestion
Description
Description
I have icrs coordinates(SkyCoord) of two sources. Using astropy directional_offset_by() method I have found position angle and separation between them.
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)
>>> Pos_ang: 211.53381678550537 deg , Separation: 4.602675965054662 degExpected behavior
So when I add this position angle and separation to the first Skycoord I should get the second SkyCoord, and I did.
Peg_from_A = Alpheratz.directional_offset_by(position_angle = Pos_ang, separation = Sep)
print("Peg from name:",Peg,"\nPeg from A:", Peg_from_A)
>>>Peg from name: <SkyCoord (ICRS): (ra, dec) in deg
(359.43969503, 25.14140221)>
>>>Peg from Alpheratz: <SkyCoord (ICRS): (ra, dec) in deg
(359.43969503, 25.14140221)>Actual behavior
I am expecting that if I add these position angle(or inverse position angle) and separation to the second source to get to first source, I get different results for the first source.
Separation should be the same, but the position angle should be rotated by 180 deg, right?
Alpheratz_back_from_Peg = Peg_from_Alpheratz.directional_offset_by(position_angle = Pos_ang - 180*u.deg,
separation = Sep)
# Compare these two sky positions for Alpheratz
print("Alpheratz from Name:", Alpheratz, "\nAlpheratz back from Peg from Alpheratz", Alpheratz_back_from_Peg)
>>>Alpheratz from Name: <SkyCoord (ICRS): (ra, dec) in deg
(2.09691619, 29.09043112)>
>>>Alpheratz back from Peg from Alpheratz <SkyCoord (ICRS): (ra, dec) in deg
(2.19111289, 29.03866084)>I am missing something obvious but can't see what.
Metadata
Metadata
Assignees
Labels
Close?Tell stale bot that this issue/PR is staleTell stale bot that this issue/PR is stalecoordinatesquestion
Activity
ayshih commentedon Apr 5, 2021
If you're still puzzling over this, the issue is that position angles aren't invertible by a simple 180 degrees for general source locations on the celestial sphere. (This is because "North" at different locations generally doesn't point in the same direction.) Here's an artificial example:
tosaric commentedon Apr 7, 2021
Hi @ayshih
Yes, I see that position angle aren't invertible by 180 degrees, but thanks for clear explanation.
My question still is, is it possible to know what would be the inverse of position angle?
I mean, if I have coordinates for both sources, and separation and position angle for let's say from source1 to source2; let's call them separation1, position_angle1.
Is it possible to calculate position_angle2(from source2 to source1) from position_angle1?
ayshih commentedon Apr 7, 2021
Yes, from
source2,separation, andposition_angle1to2, you should be able to solve forsource1andposition_angle2to1via trigonometry.Alternatively, if you don't want to figure out the trigonometry, you could brute-force it through a numerical solver; the solution is somewhere on the spherical circle of radius
separation.embray commentedon Jun 21, 2021
No further updates on this, so I think the question can be closed. @tosaric Feel free to follow up if you still have questions about this.