|
17 | 17 | import numpy as np |
18 | 18 | from scipy import constants |
19 | 19 | 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 |
21 | 25 | from scipy.interpolate import interp1d |
22 | 26 |
|
23 | 27 | from pymatgen.io.vasp.outputs import Vasprun |
@@ -187,7 +191,7 @@ def slme( |
187 | 191 | solar_spectra_photon_flux = solar_spectra_irradiance * (solar_spectra_wavelength_meters / (h * c)) |
188 | 192 |
|
189 | 193 | # 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) |
191 | 195 |
|
192 | 196 | # calculation of blackbody irradiance spectra |
193 | 197 | # units of W/(m**3), different than solar_spectra_irradiance!!! (This |
@@ -232,15 +236,15 @@ def slme( |
232 | 236 | J_0_r = ( |
233 | 237 | e |
234 | 238 | * np.pi |
235 | | - * simps( |
| 239 | + * simpson( |
236 | 240 | blackbody_photon_flux * absorbed_by_wavelength, |
237 | 241 | solar_spectra_wavelength_meters, |
238 | 242 | ) |
239 | 243 | ) |
240 | 244 |
|
241 | 245 | J_0 = J_0_r / fr |
242 | 246 |
|
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) |
244 | 248 |
|
245 | 249 | def J(V): |
246 | 250 | return J_sc - J_0 * (np.exp(e * V / (k * temperature)) - 1.0) |
|
0 commit comments