ITA-Solar / helita

A Python library for solar physics from the Institute of Theoretical Astrophysics, University of Oslo
BSD 3-Clause "New" or "Revised" License
9 stars 17 forks source link

No module named scipy.integrate.quadrature #25

Closed retifrav closed 3 years ago

retifrav commented 3 years ago

I was trying to use Helita in a Jupyter notebook, and import statement have failed with the following error:

---> 10 from scipy.integrate.quadrature import cumtrapz
     11 from scipy.interpolate import interp1d
     12 from astropy import units as u

ModuleNotFoundError: No module named 'scipy.integrate.quadrature'

I've checked the SciPy documentation, and quadrature is not a module but a function, and to fix that the following change is required in sources:

--- a/helita/vis/rh15d_vis.py
+++ b/helita/vis/rh15d_vis.py
-from scipy.integrate.quadrature import cumtrapz
+from scipy.integrate import quadrature
+from scipy.integrate import cumtrapz

I can create a pull-request, if you want.

By the way, quadrature doesn't seem to be used at all, so this line might even be deleted. Also, the cumtrapz function seems to be renamed to cumulative_trapezoid in latest versions if SciPy.

I've also put here another issue with Jupyter notebooks from RH15D repository, but then I realized that it will be better to post it there.

souvikita commented 3 years ago

These commands were based on an earlier version of Scipy, I suppose. So in case, somebody uses the older version they might end up having issues.

tiagopereira commented 3 years ago

This was the old location in Scipy. Since Scipy 1.6.0 has been out for less than a month, and using cumulative_trapezoid is not backwards compatible, I still use cumtrapz but updated the location in 169729242cd83244994c4a29767a4b64b2159e2b.