Skip to content

Unexpected behavior with SkyCoord.separation method #6633

@petigura

Description

@petigura

Dear Astropy,

Thanks for such a useful project!

I noticed an unexpected behavior when computing separations between two sets of SkyCoords. When one of the SkyCoods is an array and the other is a single value, array.separation(value) produces the correct result but value.separation(array) does not. Here's a simple example involving computing the distance between the Kepler field and the moon.

Cheers,

Erik

%pylab inline
from astropy.time import Time
import astropy.coordinates
from astropy.coordinates import SkyCoord, EarthLocation
from astropy import units as u

loc = EarthLocation.of_site('KPNO')

t0 = Time('2017-01-01 00:00:00', scale='utc')
t = t0 + np.arange(0.,365,1) * u.day
moon = astropy.coordinates.get_moon(t,location=loc)
kepler = SkyCoord('19h22m', '+44d30m', frame='icrs')

sep = moon.separation(kepler)
plot(t.datetime, sep.degree)

sep = kepler.separation(moon)
plot(t.datetime, sep.degree)

image

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