Skip to content

TST: test_aa_high_precision failed with float comparison #11527

@pllim

Description

@pllim
____________________________ test_aa_high_precision ____________________________

    @pytest.mark.remote_data
    def test_aa_high_precision():
        """These tests are provided by @mkbrewer - see issue #10356.
    
        The code that produces them agrees very well (<0.5 mas) with SkyField once Polar motion
        is turned off, but SkyField does not include polar motion, so a comparison to Skyfield
        or JPL Horizons will be ~1" off.
    
        The absence of polar motion within Skyfield and the disagreement between Skyfield and Horizons
        make high precision comparisons to those codes difficult.
    
        Updated 2020-11-29, after the comparison between codes became even better,
        down to 100 nas.
    
        NOTE: the agreement reflects consistency in approach between two codes,
        not necessarily absolute precision.  If this test starts failing, the
        tolerance can and shouls be weakened *if* it is clear that the change is
        due to an improvement (e.g., a new IAU precession model).
    
        """
        lat = -22.959748*u.deg
        lon = -67.787260*u.deg
        elev = 5186*u.m
        loc = EarthLocation.from_geodetic(lon, lat, elev)
        # Note: at this level of precision for the comparison, we have to include
        # the location in the time, as it influences the transformation to TDB.
        t = Time('2017-04-06T00:00:00.0', location=loc)
        with solar_system_ephemeris.set('de430'):
            moon = get_body('moon', t, loc)
            moon_aa = moon.transform_to(AltAz(obstime=t, location=loc))
    
        # Numbers from
        # https://github.com/astropy/astropy/pull/11073#issuecomment-735486271
        TARGET_AZ, TARGET_EL = 15.032673509886*u.deg, 50.303110133928*u.deg
        TARGET_DISTANCE = 376252883.247239*u.m
    
>       assert_allclose(moon_aa.az, TARGET_AZ, atol=0.1*u.uas, rtol=0)

../../.tox/py37-test-devdeps/lib/python3.7/site-packages/astropy/coordinates/tests/test_intermediate_transformations.py:712: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = <Longitude 15.03267351 deg>, desired = <Quantity 15.03267351 deg>
rtol = 0, atol = <Quantity 0.1 uas>, kwargs = {}
np = <module 'numpy' from '/home/runner/work/astropy/astropy/.tox/py37-test-devdeps/lib/python3.7/site-packages/numpy/__init__.py'>
_unquantify_allclose_arguments = <function _unquantify_allclose_arguments at 0x7f35f229ed40>

    def assert_quantity_allclose(actual, desired, rtol=1.e-7, atol=None,
                                 **kwargs):
        """
        Raise an assertion if two objects are not equal up to desired tolerance.
    
        This is a :class:`~astropy.units.Quantity`-aware version of
        :func:`numpy.testing.assert_allclose`.
        """
        import numpy as np
        from astropy.units.quantity import _unquantify_allclose_arguments
        np.testing.assert_allclose(*_unquantify_allclose_arguments(
>           actual, desired, rtol, atol), **kwargs)
E       AssertionError: 
E       Not equal to tolerance rtol=0, atol=2.77778e-11
E       
E       Mismatched elements: 1 / 1 (100%)
E       Max absolute difference: 8.63433769e-11
E       Max relative difference: 5.74371397e-12
E        x: array(15.032674)
E        y: array(15.032674)

../../.tox/py37-test-devdeps/lib/python3.7/site-packages/astropy/tests/helper.py:484: AssertionError

Since we use numpy-dev and run remote data in this job, hard to tell if this is caused by numpy dev or some remote thingy.

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