-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
I'm seeing the following failure in astropy.coordinates with numpy-dev:
def test_frame_init():
"""
Different ways of providing the frame.
"""
sc = SkyCoord(RA, DEC, frame='icrs')
assert sc.frame_name == 'icrs'
sc = SkyCoord(RA, DEC, frame=ICRS)
assert sc.frame_name == 'icrs'
sc = SkyCoord(RA, DEC, 'icrs')
assert sc.frame_name == 'icrs'
> sc = SkyCoord(RA, DEC, ICRS)
astropy/coordinates/tests/test_sky_coord.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[RuntimeError("maximum recursion depth exceeded") raised in repr()] SafeRepr object at 0x106f706c8>
args = [<Quantity 1.0 deg>, <Quantity 2.0 deg>, <class 'astropy.coordinates.builtin_frames.ICRS'>]
kwargs = {}
def __init__(self, *args, **kwargs):
# Parse the args and kwargs to assemble a sanitized and validated
# kwargs dict for initializing attributes for this object and for
# creating the internal self._sky_coord_frame object
args = list(args) # Make it mutable
> kwargs = self._parse_inputs(args, kwargs)
astropy/coordinates/sky_coordinate.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[RuntimeError("maximum recursion depth exceeded") raised in repr()] SafeRepr object at 0x106e6eea8>
args = [<Quantity 1.0 deg>, <Quantity 2.0 deg>, <class 'astropy.coordinates.builtin_frames.ICRS'>]
kwargs = {}
def _parse_inputs(self, args, kwargs):
"""
Assemble a validated and sanitized keyword args dict for instantiating a
SkyCoord and coordinate object from the provided `args`, and `kwargs`.
"""
valid_kwargs = {}
# Put the SkyCoord attributes like frame, equinox, obstime, location
# into valid_kwargs dict. `Frame` could come from args or kwargs, so
# set valid_kwargs['frame'] accordingly. The others must be specified
# by keyword args or else get a None default. Pop them off of kwargs
# in the process.
> frame = valid_kwargs['frame'] = _get_frame_name(args, kwargs)
astropy/coordinates/sky_coordinate.py:140:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = [<Quantity 1.0 deg>, <Quantity 2.0 deg>, <class 'astropy.coordinates.builtin_frames.ICRS'>]
kwargs = {}
def _get_frame_name(args, kwargs):
"""
Determine the coordinate frame from input SkyCoord args and kwargs. This
modifies args and/or kwargs in-place to remove the item that provided
`frame`. It also infers the frame if an input coordinate was provided and
checks for conflicts.
This allows for frame to be specified as a string like 'icrs' or a frame
class like ICRS, but not an instance ICRS() since the latter could have
non-default preferred attributes which would require a three-way merge.
"""
frame = kwargs.pop('frame', None)
if frame is not None:
# Frame was provided as kwarg so validate and coerce into corresponding frame.
frame_cls = _get_frame_class(frame)
frame_name = frame_cls.name
else:
# Look for the frame in args
for arg in args:
try:
frame_cls = _get_frame_class(arg)
except ValueError:
pass
else:
frame_name = frame_cls.name
> args.remove(arg)
E DeprecationWarning: elementwise comparison failed; this will raise the error in the future.