Skip to content

Inverse of Position angle #11434

Closed
Closed

Description

@tosaric

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 deg

Expected 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.

Activity

  1. ayshih commented on Apr 5, 2021

    @ayshih
    Contributor

    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:

    >>> from astropy.coordinates import SkyCoord
    >>> import astropy.units as u
    >>> a = SkyCoord(0*u.deg, 70*u.deg)
    >>> b = SkyCoord(90*u.deg, 80*u.deg)
    >>> a.position_angle(b).to('deg')
    <Angle 27.27316956 deg>
    >>> b.position_angle(a).to('deg')
    <Angle 295.50555026 deg>
  2. added
    Close?Tell stale bot that this issue/PR is stale
    on Apr 5, 2021
  3. tosaric commented on Apr 7, 2021

    @tosaric
    Author

    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?

  4. ayshih commented on Apr 7, 2021

    @ayshih
    Contributor

    Yes, from source2, separation, and position_angle1to2, you should be able to solve for source1 and position_angle2to1 via 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.

  5. embray commented on Jun 21, 2021

    @embray
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions