Skip to content

SkyCoord.separation not symmetric #5185

@StuartLittlefair

Description

@StuartLittlefair

When calculating separations between SkyCoords in AltAz and ICRS frames, it matters which way round you calculate the separation! For example:

In [1]: from astropy import coordinates as coord, units as u
In [2]: from astropy.time import Time
In [3]: time = Time('2003-04-05 06:07:08')
In [4]: loc = coord.EarthLocation(*(-1463969.3018517173,
                                                            -5166673.342234327,
                                                            3434985.7120456537)*u.m)
In [5]: altaz_frame = coord.AltAz(location=loc, obstime=time)
In [6]: moon = coord.get_moon(time, location=loc).transform_to(altaz_frame)
In [7]: one_deg_away = coord.SkyCoord(az=moon.az, alt=moon.alt+1*u.deg, frame=moon.frame)
In [8]: icrs_coord = one_deg_away.icrs
In [9]: icrs_coord.separation(moon)
Out[9]: <Angle 0.9999999999666758 deg>
In [10]: moon.separation(icrs_coord)
Out[10]: <Angle 141.88054031044086 deg>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions