Skip to content

Commit f82fd68

Browse files
authored
remove numpy 1.14 hack (pvlib#1618)
1 parent 771eb46 commit f82fd68

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

pvlib/ivtools/sde.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@
1010
from pvlib.ivtools.utils import _schumaker_qspline
1111

1212

13-
# set constant for numpy.linalg.lstsq parameter rcond
14-
# rcond=-1 for numpy<1.14, rcond=None for numpy>=1.14
15-
# TODO remove after minimum numpy version >= 1.14
16-
minor = int(np.__version__.split('.')[1])
17-
if minor < 14:
18-
RCOND = -1
19-
else:
20-
RCOND = None
21-
22-
2313
def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
2414
vlim=0.2, ilim=0.1):
2515
r"""
@@ -228,7 +218,7 @@ def _sandia_beta3_beta4(voltage, current, beta0, beta1, ilim, i_sc):
228218
x = np.array([np.ones_like(voltage), voltage, current]).T
229219
# Select points where y > ilim * i_sc to regress log(y) onto x
230220
idx = (y > ilim * i_sc)
231-
result = np.linalg.lstsq(x[idx], np.log(y[idx]), rcond=RCOND)
221+
result = np.linalg.lstsq(x[idx], np.log(y[idx]), rcond=None)
232222
coef = result[0]
233223
beta3 = coef[1].item()
234224
beta4 = coef[2].item()
@@ -444,7 +434,7 @@ def _cocontent_regress(v, i, voc, isc, cci):
444434
sx = np.vstack((s[:, 0], s[:, 1], s[:, 0] * s[:, 1], s[:, 0] * s[:, 0],
445435
s[:, 1] * s[:, 1], col1)).T
446436

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

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

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

0 commit comments

Comments
 (0)