Visitar URL original
test_shadow.py tests fail due to non-converging dummy Shadow · Issue #663 · einsteinpy/einsteinpy · GitHub
Skip to content

test_shadow.py tests fail due to non-converging dummy Shadow #663

Open

Description

@olebole

🐞 Problem

When running the CI tests for Einsteinpy on the Debian package, we see the following error when running the tests in test_shadow.py:

____________ ERROR at setup of test_plotter_has_correct_attributes _____________

    @pytest.fixture()
    def dummy_data():
        mass = 1 * u.kg
        fov = 30 * u.km
>       shadow = Shadow(mass=mass, fov=fov, n_rays=1000)

tests/test_plotting/test_rays/test_shadow.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/astropy/units/decorators.py:313: in wrapper
    return_ = wrapped_function(*func_args, **func_kwargs)
einsteinpy/rays/shadow.py:29: in __init__
    root = newton(self._root_equation, 0.1, args=(i,))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <bound method Shadow._root_equation of <einsteinpy.rays.shadow.Shadow object at 0x7fa325ad9670>>
x0 = 0.1, fprime = None, args = (5.196152422706632,), tol = 1.48e-08
maxiter = 50, fprime2 = None, x1 = None, rtol = 0.0, full_output = False
disp = True

    def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50,
               fprime2=None, x1=None, rtol=0.0,
               full_output=False, disp=True):
[…]    
        if disp:
            msg = ("Failed to converge after %d iterations, value is %s."
                   % (itr + 1, p))
>           raise RuntimeError(msg)
E           RuntimeError: Failed to converge after 50 iterations, value is nan.

/usr/lib/python3/dist-packages/scipy/optimize/_zeros_py.py:391: RuntimeError

This is also reported as debian#1063527.

  • scipy 1.13.1 (Debian bug report is with 1.11)
  • numpy 1.26.4
  • python 3.12.5 (3.11 is also affected)

🎯 Goal

Having all CI tests running helps us to make sure that all software in Debian works together properly.

💡 Possible solutions

The error is obviously a byproduct; it is not a failure of the test itself. I could just skip these tests. However, it may point to some real problem within Einsteinpy if a "dummy" initialization fails, therefore I would wait for your advise here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions