Closed vsnever closed 3 months ago
Fixed in #437.
I am getting an ImportError with Scipy 1.14:
File /usr/local/lib/python3.10/dist-packages/cherab/core/model/attenuator/init.py:1 from .singleray import SingleRayAttenuator File /usr/local/lib/python3.10/dist-packages/cherab/core/model/attenuator/singleray.pyx:21, in init cherab.core.model.attenuator.singleray() ImportError: cannot import name cumtrapz
I tried adding
try:
from scipy.integrate import cumulative_trapezoid
except ImportError:
from scipy.integrate import cumtrapz as cumulative_trapezoid
to the file singleray.pyx
instead of the from scipy.integrate import cumtrapz
but it still gave the same error after that. I am not too familiar with how the C and Python interacts (if this problem even relates to that) so I would appreciate some help.
Hi @leferi99,
The issue is already fixed in the development branch. Have you recompile/reinstall Cherab after applying the local fix? Also try installing Cherab 1.5 Release Candidate 2 with pip install cherab==1.5.0rc2
and see if the warning still appears.
Thank you @vsnever this fixed it. I used the simple pip install so I still had the release version, not the development.
When calculating with the
Beam
, SciPy 1.12 raisesDeprecationWarning
:Therefore, we need to replace deprecated
cumtrapz()
with thecumulative_trapezoid()
inSingeRayAttenuator._beam_attenuation()
. However, the new name was only introduced in SciPy 1.7, and the tests fail in the Python 3.7 + oldest-supported-numpy environment.I suggest using: