Skip to content

Commit 4127d82

Browse files
committed
Fix deprecated simps function name in scipy.
1 parent 89691c8 commit 4127d82

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pymatgen/analysis/solar/slme.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
import numpy as np
1818
from scipy import constants
1919
from scipy.constants import physical_constants, speed_of_light
20-
from scipy.integrate import simps
20+
21+
try:
22+
from scipy.integrate import simpson
23+
except ImportError:
24+
from scipy.integrate import simps as simpson
2125
from scipy.interpolate import interp1d
2226

2327
from pymatgen.io.vasp.outputs import Vasprun
@@ -187,7 +191,7 @@ def slme(
187191
solar_spectra_photon_flux = solar_spectra_irradiance * (solar_spectra_wavelength_meters / (h * c))
188192

189193
# Calculation of total solar power incoming
190-
power_in = simps(solar_spectra_irradiance, solar_spectra_wavelength)
194+
power_in = simpson(solar_spectra_irradiance, solar_spectra_wavelength)
191195

192196
# calculation of blackbody irradiance spectra
193197
# units of W/(m**3), different than solar_spectra_irradiance!!! (This
@@ -232,15 +236,15 @@ def slme(
232236
J_0_r = (
233237
e
234238
* np.pi
235-
* simps(
239+
* simpson(
236240
blackbody_photon_flux * absorbed_by_wavelength,
237241
solar_spectra_wavelength_meters,
238242
)
239243
)
240244

241245
J_0 = J_0_r / fr
242246

243-
J_sc = e * simps(solar_spectra_photon_flux * absorbed_by_wavelength, solar_spectra_wavelength)
247+
J_sc = e * simpson(solar_spectra_photon_flux * absorbed_by_wavelength, solar_spectra_wavelength)
244248

245249
def J(V):
246250
return J_sc - J_0 * (np.exp(e * V / (k * temperature)) - 1.0)

0 commit comments

Comments
 (0)