Skip to content

Commit

Permalink
Fix deprecated simps function name in scipy.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jun 26, 2024
1 parent 89691c8 commit 4127d82
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pymatgen/analysis/solar/slme.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
import numpy as np
from scipy import constants
from scipy.constants import physical_constants, speed_of_light
from scipy.integrate import simps

try:
from scipy.integrate import simpson
except ImportError:
from scipy.integrate import simps as simpson
from scipy.interpolate import interp1d

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

# Calculation of total solar power incoming
power_in = simps(solar_spectra_irradiance, solar_spectra_wavelength)
power_in = simpson(solar_spectra_irradiance, solar_spectra_wavelength)

# calculation of blackbody irradiance spectra
# units of W/(m**3), different than solar_spectra_irradiance!!! (This
Expand Down Expand Up @@ -232,15 +236,15 @@ def slme(
J_0_r = (
e
* np.pi
* simps(
* simpson(
blackbody_photon_flux * absorbed_by_wavelength,
solar_spectra_wavelength_meters,
)
)

J_0 = J_0_r / fr

J_sc = e * simps(solar_spectra_photon_flux * absorbed_by_wavelength, solar_spectra_wavelength)
J_sc = e * simpson(solar_spectra_photon_flux * absorbed_by_wavelength, solar_spectra_wavelength)

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

0 comments on commit 4127d82

Please sign in to comment.