Skip to content

TST: coordinates and modeling test failures in devdeps job #14705

Closed

Description

@pllim

Possibly caused by numpy-dev (job was green yesterday) but at a glance, it is not obvious to me which PR from numpy because by the time we get their "nightly" wheel, there are a bunch of new changes already. Any ideas, @mhvk or @WilliamJamieson ?

Example log: https://github.com/astropy/astropy/actions/runs/4824137341/jobs/8593539535

___________________ test_itrs_topo_to_altaz_with_refraction ____________________

    def test_itrs_topo_to_altaz_with_refraction():
        loc = EarthLocation(lat=0 * u.deg, lon=0 * u.deg, height=0 * u.m)
        usph = golden_spiral_grid(200)
        dist = np.linspace(1.0, 1000.0, len(usph)) * u.au
        icrs = ICRS(ra=usph.lon, dec=usph.lat, distance=dist)
        altaz_frame1 = AltAz(obstime="J2000", location=loc)
        altaz_frame2 = AltAz(
            obstime="J2000", location=loc, pressure=1000.0 * u.hPa, relative_humidity=0.5
        )
# ...
        assert_allclose(altaz33.az - altaz3.az, 0 * u.mas, atol=0.1 * u.mas)
        assert_allclose(altaz33.alt - altaz3.alt, 0 * u.mas, atol=0.1 * u.mas)
>       assert_allclose(altaz33.distance - altaz3.distance, 0 * u.cm, atol=10.0 * u.cm)

coordinates/tests/test_intermediate_transformations.py:275: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/helper.py:487: in assert_quantity_allclose
    np.testing.assert_allclose(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x7f0599934220>, array([-6.66133815e-16, -3.55271368e-15, -8.88178420e-....95807864e-13, -7.95807864e-13,
       -7.95807864e-13, -7.95807864e-13, -4.54747351e-13, -6.82121026e-13]), array(0.))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=6.68459e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=6.68459e-13
E           
E           Mismatched elements: 9 / 200 (4.5%)
E           Max absolute difference: 7.95807864e-13
E           Max relative difference: inf
E            x: array([-6.661338e-16, -3.552714e-15, -8.881784e-15, -1.065814e-14,
E                  -1.421085e-14, -2.486900e-14, -2.131628e-14, -2.131628e-14,
E                  -7.105427e-15, -2.131628e-14, -2.842171e-14, -4.973799e-14,...
E            y: array(0.)

___________________ test_itrs_topo_to_hadec_with_refraction ____________________

    def test_itrs_topo_to_hadec_with_refraction():
        loc = EarthLocation(lat=0 * u.deg, lon=0 * u.deg, height=0 * u.m)
        usph = golden_spiral_grid(200)
        dist = np.linspace(1.0, 1000.0, len(usph)) * u.au
        icrs = ICRS(ra=usph.lon, dec=usph.lat, distance=dist)
        hadec_frame1 = HADec(obstime="J2000", location=loc)
        hadec_frame2 = HADec(
            obstime="J2000", location=loc, pressure=1000.0 * u.hPa, relative_humidity=0.5
        )
# ...


        assert_allclose(hadec33.ha - hadec3.ha, 0 * u.mas, atol=0.1 * u.mas)
        assert_allclose(hadec33.dec - hadec3.dec, 0 * u.mas, atol=0.1 * u.mas)
>       assert_allclose(hadec33.distance - hadec3.distance, 0 * u.cm, atol=10.0 * u.cm)

coordinates/tests/test_intermediate_transformations.py:330: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/helper.py:487: in assert_quantity_allclose
    np.testing.assert_allclose(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x7f05999fa3e0>, array([-1.11022302e-15, -4.44089210e-15, -8.88178420e-....02318154e-12, -1.02318154e-12,
       -1.13686838e-12, -1.02318154e-12, -5.68434189e-13, -1.02318154e-12]), array(0.))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=6.68459e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=6.68459e-13
E           
E           Mismatched elements: 24 / 200 (12%)
E           Max absolute difference: 1.13686838e-12
E           Max relative difference: inf
E            x: array([-1.110223e-15, -4.440892e-15, -8.881784e-15, -1.421085e-14,
E                  -1.421085e-14, -3.552714e-14, -2.842171e-14, -2.131628e-14,
E                  -1.421085e-14, -2.842171e-14, -2.842171e-14, -5.684342e-14,...
E            y: array(0.)

____________________________ test_minimal_subclass _____________________________

    def test_minimal_subclass():
        # Basically to check what we document works;
        # see doc/coordinates/representations.rst
        class LogDRepresentation(BaseRepresentation):

# ...
        ld3 = LogDRepresentation.from_cartesian(c)
        assert np.all(ld3.lon == ld2.lon)
        assert np.all(ld3.lat == ld2.lat)
>       assert np.all(ld3.logd == ld2.logd)
E       assert False
E        +  where False = <function all at 0x7f05bc14b900>(<Dex 1. dex(kpc)> == <Dex 1. dex(kpc)>)
E        +    where <function all at 0x7f05bc14b900> = np.all
E        +    and   <Dex 1. dex(kpc)> = <LogDRepresentation (lon, lat, logd) in (rad, rad, dex(kpc))\n    (1.57079633, 0., 1.)>.logd
E        +    and   <Dex 1. dex(kpc)> = <LogDRepresentation (lon, lat, logd) in (deg, deg, dex(kpc))\n    (90., 0., 1.)>.logd

coordinates/tests/test_representation.py:1653: AssertionError
_________________ [doctest] astropy.modeling.core.custom_model _________________
4383         >>> def sine_model(x, amplitude=1., frequency=1.):
4384         ...     return amplitude * np.sin(2 * np.pi * frequency * x)
4385         >>> def sine_deriv(x, amplitude=1., frequency=1.):
4386         ...     return 2 * np.pi * amplitude * np.cos(2 * np.pi * frequency * x)
4387         >>> SineModel = custom_model(sine_model, fit_deriv=sine_deriv)
4388 
4389     Create an instance of the custom model and evaluate it::
4390 
4391         >>> model = SineModel()
4392         >>> model(0.25)
Expected:
    1.0
Got:
    0.9999999999999998

modeling/core.py:4392: DocTestFailure
______________________ test_fix_inputs_with_bounding_box _______________________

    def test_fix_inputs_with_bounding_box():
        g1 = Gaussian2D(1, 0, 0, 1, 1)
        g2 = Gaussian2D(1, 0, 0, 1, 1)
>       assert g1.bounding_box == ((-5.5, 5.5), (-5.5, 5.5))
E       AssertionError: assert ModelBounding...   order='C'\n) == ((-5.5, 5.5), (-5.5, 5.5))
E         Full diff:
E         - (
E         -  (-5.5,
E         -   5.5),
E         -  (-5.5,
E         -   5.5),
E         + ModelBoundingBox(
E         +     intervals={
E         +         x: Interval(lower=-5.5, upper=5.5)
E         +         y: Interval(lower=-5.499999999999999, upper=5.499999999999999)
E         +     }
E         +     model=Gaussian2D(inputs=('x', 'y'))
E         +     order='C'
E         + ,
E           )

modeling/tests/test_compound.py:392: AssertionError
____ TestFittable2DModels.test_bounding_box2D[Gaussian2D-test_parameters4] _____

self = <astropy.modeling.tests.test_models.TestFittable2DModels object at 0x7f05a1892390>
model_class = <class 'astropy.modeling.functional_models.Gaussian2D'>
Name: Gaussian2D
N_inputs: 2
N_outputs: 1
Fittable parameters: ('amplitude', 'x_mean', 'y_mean', 'x_stddev', 'y_stddev', 'theta')
test_parameters = {'bbox_peak': True, 'constraints': {'fixed': {'theta': True}}, 'deriv_initial': [10, 5, 5, 4, 4, 0.5], 'deriv_parameters': [137.0, 5.1, 5.4, 1.5, 2.0, 0.7853981633974483], ...}

    def test_bounding_box2D(self, model_class, test_parameters):
        """Test bounding box evaluation"""

# ...
        inside_bbox = model(x1, y1)
        outside_bbox = model(x2, y2, with_bounding_box=True)
        outside_bbox = outside_bbox[~np.isnan(outside_bbox)]
    
>       assert np.all(inside_bbox == outside_bbox)
E       ValueError: operands could not be broadcast together with shapes (1100,) (1099,)

modeling/tests/test_models.py:255: ValueError

Activity

  1. pllim commented on Apr 27, 2023

    @pllim
    MemberAuthor

    Could it be numpy/numpy#23399 ? 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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