diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index 1ae618cb9f..c3340f4e15 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -117,7 +117,7 @@ "build": "", "numpy": "1.16.0", "pandas": "0.25.0", - "scipy": "1.2.0", + "scipy": "1.4.0", // Note: these don't have a minimum in setup.py "h5py": "2.10.0", "ephem": "3.7.6.0", diff --git a/ci/requirements-py3.10.yml b/ci/requirements-py3.10.yml index c7e5248230..a2b2284c37 100644 --- a/ci/requirements-py3.10.yml +++ b/ci/requirements-py3.10.yml @@ -23,7 +23,7 @@ dependencies: - python=3.10 - pytz - requests - - scipy >= 1.2.0 + - scipy >= 1.4.0 - shapely # pvfactors dependency # - siphon # conda-forge - statsmodels diff --git a/ci/requirements-py3.7-min.yml b/ci/requirements-py3.7-min.yml index d93d0b2bd3..71acbf8aec 100644 --- a/ci/requirements-py3.7-min.yml +++ b/ci/requirements-py3.7-min.yml @@ -17,7 +17,7 @@ dependencies: - h5py==3.1.0 - numpy==1.16.0 - pandas==0.25.0 - - scipy==1.2.0 + - scipy==1.4.0 - pytest-rerunfailures # conda version is >3.6 - pytest-remotedata # conda package is 0.3.0, needs > 0.3.1 - requests-mock diff --git a/ci/requirements-py3.7.yml b/ci/requirements-py3.7.yml index 8a971d728a..4a03fdb928 100644 --- a/ci/requirements-py3.7.yml +++ b/ci/requirements-py3.7.yml @@ -23,7 +23,7 @@ dependencies: - python=3.7 - pytz - requests - - scipy >= 1.2.0 + - scipy >= 1.4.0 - shapely # pvfactors dependency - siphon # conda-forge - statsmodels diff --git a/ci/requirements-py3.8.yml b/ci/requirements-py3.8.yml index db763c3d73..0ccc865928 100644 --- a/ci/requirements-py3.8.yml +++ b/ci/requirements-py3.8.yml @@ -23,7 +23,7 @@ dependencies: - python=3.8 - pytz - requests - - scipy >= 1.2.0 + - scipy >= 1.4.0 - shapely # pvfactors dependency - siphon # conda-forge - statsmodels diff --git a/ci/requirements-py3.9.yml b/ci/requirements-py3.9.yml index 3621a737b6..84b6c03b1a 100644 --- a/ci/requirements-py3.9.yml +++ b/ci/requirements-py3.9.yml @@ -23,7 +23,7 @@ dependencies: - python=3.9 - pytz - requests - - scipy >= 1.2.0 + - scipy >= 1.4.0 - shapely # pvfactors dependency # - siphon # conda-forge - statsmodels diff --git a/docs/sphinx/source/whatsnew/v0.9.4.rst b/docs/sphinx/source/whatsnew/v0.9.4.rst index efac8f7d40..aa24f61e1e 100644 --- a/docs/sphinx/source/whatsnew/v0.9.4.rst +++ b/docs/sphinx/source/whatsnew/v0.9.4.rst @@ -73,7 +73,7 @@ Benchmarking Requirements ~~~~~~~~~~~~ - +* Minimum version of scipy advanced from 1.2.0 to 1.4.0 (:issue:`483`, :pull:`1617`) Contributors ~~~~~~~~~~~~ diff --git a/pvlib/ivtools/sdm.py b/pvlib/ivtools/sdm.py index 013e63f9a6..70c3be389f 100644 --- a/pvlib/ivtools/sdm.py +++ b/pvlib/ivtools/sdm.py @@ -8,7 +8,7 @@ import numpy as np -import scipy.constants +from scipy import constants from scipy import optimize from scipy.special import lambertw from scipy.misc import derivative @@ -20,6 +20,9 @@ from pvlib.ivtools.sde import _fit_sandia_cocontent +CONSTANTS = {'E0': 1000.0, 'T0': 25.0, 'k': constants.k, 'q': constants.e} + + def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, gamma_pmp, cells_in_series, temp_ref=25): """ @@ -204,7 +207,7 @@ def fit_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, cells_in_series, """ # Constants - k = scipy.constants.value('Boltzmann constant in eV/K') + k = constants.value('Boltzmann constant in eV/K') # in eV/K Tref = temp_ref + 273.15 # [K] # initial guesses of variables for computing convergence: @@ -340,9 +343,9 @@ def fit_pvsyst_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): T0 : float cell temperature at STC, default 25 [C] k : float - 1.38066E-23 J/K (Boltzmann's constant) + Boltzmann's constant [J/K] q : float - 1.60218E-19 Coulomb (elementary charge) + elementary charge [Coulomb] maxiter : int, default 5 input that sets the maximum number of iterations for the parameter @@ -417,7 +420,7 @@ def fit_pvsyst_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): """ if const is None: - const = {'E0': 1000.0, 'T0': 25.0, 'k': 1.38066e-23, 'q': 1.60218e-19} + const = CONSTANTS ee = ivcurves['ee'] tc = ivcurves['tc'] @@ -520,9 +523,9 @@ def fit_desoto_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): T0 : float cell temperature at STC, default 25 [C] k : float - 1.38066E-23 J/K (Boltzmann's constant) + Boltzmann's constant [J/K] q : float - 1.60218E-19 Coulomb (elementary charge) + elementary charge [Coulomb] maxiter : int, default 5 input that sets the maximum number of iterations for the parameter @@ -579,7 +582,7 @@ def fit_desoto_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): """ if const is None: - const = {'E0': 1000.0, 'T0': 25.0, 'k': 1.38066e-23, 'q': 1.60218e-19} + const = CONSTANTS ee = ivcurves['ee'] tc = ivcurves['tc'] diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index 5c72e279f5..c6e0beb9c7 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -10,6 +10,7 @@ import os from urllib.request import urlopen import numpy as np +from scipy import constants import pandas as pd from dataclasses import dataclass from abc import ABC, abstractmethod @@ -2043,8 +2044,8 @@ def calcparams_desoto(effective_irradiance, temp_cell, Source: [4] ''' - # Boltzmann constant in eV/K - k = 8.617332478e-05 + # Boltzmann constant in eV/K, 8.617332478e-05 + k = constants.value('Boltzmann constant in eV/K') # reference temperature Tref_K = temp_ref + 273.15 @@ -2301,10 +2302,10 @@ def calcparams_pvsyst(effective_irradiance, temp_cell, ''' # Boltzmann constant in J/K - k = 1.38064852e-23 + k = constants.k # elementary charge in coulomb - q = 1.6021766e-19 + q = constants.e # reference temperature Tref_K = temp_ref + 273.15 @@ -2576,8 +2577,8 @@ def sapm(effective_irradiance, temp_cell, module): temp_ref = 25 irrad_ref = 1000 - q = 1.60218e-19 # Elementary charge in units of coulombs - kb = 1.38066e-23 # Boltzmann's constant in units of J/K + q = constants.e # Elementary charge in units of coulombs + kb = constants.k # Boltzmann's constant in units of J/K # avoid problem with integer input Ee = np.array(effective_irradiance, dtype='float64') / irrad_ref diff --git a/setup.py b/setup.py index 134ec1d88c..0533748b2e 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ 'pandas >= 0.25.0', 'pytz', 'requests', - 'scipy >= 1.2.0', + 'scipy >= 1.4.0', 'h5py', 'importlib-metadata; python_version < "3.8"']