astropy: Test failure with coordinates: 'NoneType' object has no attribute 'to_geodetic'
- Revert #11319
There is a test failure in coordinates
in the 32bits job:
'NoneType' object has no attribute 'to_geodetic'
https://github.com/astropy/astropy/pull/11274/checks?check_run_id=1772534200
_______________ test_skyoffset[inradec0-expectedlatlon0-tolsep0] _______________
inradec = <Quantity [45., 45.] deg>, expectedlatlon = <Quantity [0., 0.] deg>
tolsep = <Quantity 0.001 arcsec>, originradec = <Quantity [45., 45.] deg>
@pytest.mark.parametrize("inradec,expectedlatlon, tolsep", [
((45, 45)*u.deg, (0, 0)*u.deg, .001*u.arcsec),
((45, 0)*u.deg, (0, -45)*u.deg, .001*u.arcsec),
((45, 90)*u.deg, (0, 45)*u.deg, .001*u.arcsec),
((46, 45)*u.deg, (1*np.cos(45*u.deg), 0)*u.deg, 16*u.arcsec),
])
def test_skyoffset(inradec, expectedlatlon, tolsep, originradec=(45, 45)*u.deg):
origin = ICRS(*originradec)
skyoffset_frame = SkyOffsetFrame(origin=origin)
skycoord = SkyCoord(*inradec, frame=ICRS)
skycoord_inaf = skycoord.transform_to(skyoffset_frame)
assert hasattr(skycoord_inaf, 'lon')
assert hasattr(skycoord_inaf, 'lat')
expected = SkyCoord(*expectedlatlon, frame=skyoffset_frame)
assert skycoord_inaf.separation(expected) < tolsep
# Check we can also transform back (regression test for gh-11254).
> roundtrip = skycoord_inaf.transform_to(ICRS())
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/tests/test_skyoffset_transformations.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:627: in transform_to
return self.__class__(new_coord, **frame_kwargs)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:323: in __init__
setattr(self, attr, skycoord_kwargs[attr])
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:811: in __setattr__
frame_transform_graph.frame_attributes[attr].__get__(self)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/attributes.py:104: in __get__
out, converted = self.convert_input(out)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/attributes.py:451: in convert_input
transformedobj = value.transform_to(self._frame)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py:619: in transform_to
new_coord = trans(self.frame, generic_frame)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/transformations.py:1422: in __call__
curr_coord = t(curr_coord, curr_toframe)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/transformations.py:1025: in __call__
return supcall(fromcoord, toframe)
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/builtin_frames/icrs_observed_transforms.py:29: in icrs_to_altaz
astrom = erfa_astrom.get().apco(altaz_frame)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
frame_or_coord = <AltAz Frame (obstime=None, location=None, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron)>
@staticmethod
def apco(frame_or_coord):
'''
Wrapper for ``erfa.apco``, used in conversions AltAz <-> ICRS and CIRS <-> ICRS
Arguments
---------
frame_or_coord: ``astropy.coordinates.BaseCoordinateFrame`` or ``astropy.coordinates.SkyCoord``
Frame or coordinate instance in the corresponding frame
for which to calculate the calculate the astrom values.
For this function, an AltAz or CIRS frame is expected.
'''
> lon, lat, height = frame_or_coord.location.to_geodetic('WGS84')
E AttributeError: 'NoneType' object has no attribute 'to_geodetic'
../../.tox/py38-test-double/lib/python3.8/site-packages/astropy/coordinates/erfa_astrom.py:45: AttributeError
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (22 by maintainers)
Commits related to this issue
- TST: Temporarily xfail until #11277 is solved — committed to pllim/astropy by pllim 3 years ago
- TST: Temporarily xfail until #11277 is solved — committed to namurphy/astropy by pllim 3 years ago
- TST: Temporarily xfail until #11277 is solved — committed to namurphy/astropy by pllim 3 years ago
- TST: Temporarily xfail until #11277 is solved — committed to nstarman/astropy by pllim 3 years ago
- TST: Temporarily xfail until #11277 is solved — committed to Akshat1Nar/astropy by pllim 3 years ago
- Simplify workaround for astropy bug I was working around astropy/astropy#11277 by implementing the matrix rotations myself, but a comment in the bug suggested a simpler workaround. — committed to ska-sa/katsdpmodels by bmerry 3 years ago
The problem is that the error is actually wrong: it is using the
origin
instance for a different OffsetFrame than the one that is passed in. It could happen in user code too (if they have offset frames in different coordinate systems).p.s. I do think we could have a relatively hacky work-around, but need to have some time to think it through.
Yikes, this is tricky: I cannot consistently reproduce getting the error on the 2nd run with your one-liner calling
astropy.test
twice. The first time I tried, it worked, but now tried a few times again and both calls just pass. Well, at least perhaps that is what happened to your cache clearing too?!I can reproduce locally but only if I do this. It doesn’t show when I run
pytest <filename>
twice on the terminal.So maybe the test runner is “polluting” the test somehow.
Keep in mind that the 32-bit job also runs parallel and “run the suite twice” jobs, and it is failing in
py38-test-double
, so probably some state that is kept dirty after the first run, but not always?