Skip to content

Remove numpy<=1.14 accomodation in sde.py #1618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions pvlib/ivtools/sde.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
from pvlib.ivtools.utils import _schumaker_qspline


# set constant for numpy.linalg.lstsq parameter rcond
# rcond=-1 for numpy<1.14, rcond=None for numpy>=1.14
# TODO remove after minimum numpy version >= 1.14
minor = int(np.__version__.split('.')[1])
if minor < 14:
RCOND = -1
else:
RCOND = None


def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
vlim=0.2, ilim=0.1):
r"""
Expand Down Expand Up @@ -228,7 +218,7 @@ def _sandia_beta3_beta4(voltage, current, beta0, beta1, ilim, i_sc):
x = np.array([np.ones_like(voltage), voltage, current]).T
# Select points where y > ilim * i_sc to regress log(y) onto x
idx = (y > ilim * i_sc)
result = np.linalg.lstsq(x[idx], np.log(y[idx]), rcond=RCOND)
result = np.linalg.lstsq(x[idx], np.log(y[idx]), rcond=None)
coef = result[0]
beta3 = coef[1].item()
beta4 = coef[2].item()
Expand Down Expand Up @@ -444,7 +434,7 @@ def _cocontent_regress(v, i, voc, isc, cci):
sx = np.vstack((s[:, 0], s[:, 1], s[:, 0] * s[:, 1], s[:, 0] * s[:, 0],
s[:, 1] * s[:, 1], col1)).T

gamma = np.linalg.lstsq(sx, scc, rcond=RCOND)[0]
gamma = np.linalg.lstsq(sx, scc, rcond=None)[0]
# coefficients from regression in rotated coordinates

# Principle components transformation steps
Expand Down Expand Up @@ -473,5 +463,5 @@ def _cocontent_regress(v, i, voc, isc, cci):

# translate from coefficients in rotated space (gamma) to coefficients in
# original coordinates (beta)
beta = np.linalg.lstsq(np.dot(mb, ma), gamma[0:5], rcond=RCOND)[0]
beta = np.linalg.lstsq(np.dot(mb, ma), gamma[0:5], rcond=None)[0]
return beta