Skip to content

separation fails with recursion error for some coordinates #4033

Closed

Description

@eteq

This is a subtle bug that probably slipped through the tests because it depends on a particular set of inputs. Specifically, if you ask for the separation between two SkyCoord objects when both have a distance, you get a strange error:

>>> alb = SkyCoord.from_name('Albireo')
>>> alb_wdist = SkyCoord(alb, distance=133*u.pc)
>>> de = SkyCoord.from_name('Deneb')
>>> de_wdist = SkyCoord(de, distance=802*u.pc)
>>> aa = AltAz(location=EarthLocation(lat=45*u.deg, lon=0*u.deg), obstime='2010-1-1')
>>> alb_wdistaa = alb_wdist.transform_to(aa)
>>> de_wdistaa = de_wdist.transform_to(aa)
>>> de_wdistaa.separation(alb_wdistaa)
RuntimeError: maximum recursion depth exceeded while calling a Python object

The particularly curious thing is that this does not happen if the one calling has no distance:

>>> deaa = de.transform_to(aa)
>>> albaa = alb.transform_to(aa)
>>> deaa.separation(albaa)
<Angle 22.28621055928645 deg>
>>> deaa.separation(alb_wdistaa)
<Angle [ 22.28621208] deg>
>>> alb_wdistaa.separation(deaa)
RuntimeError: maximum recursion depth exceeded while calling a Python object

The second one there is probably related to #3920, so it's quite possible a fix for that will also fix this.

Activity

  1. self-assigned this
    on Aug 3, 2015
  2. eteq commented on Aug 3, 2015

    @eteq
    MemberAuthor

    cc @bmorris3 as the one who has a use case that triggered this (astropy/astroplan#39)

  3. added this to the v1.0.4 milestone on Aug 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions