|
10 | 10 | from pvlib.ivtools.utils import _schumaker_qspline
|
11 | 11 |
|
12 | 12 |
|
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 |
| - |
23 | 13 | def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
|
24 | 14 | vlim=0.2, ilim=0.1):
|
25 | 15 | r"""
|
@@ -228,7 +218,7 @@ def _sandia_beta3_beta4(voltage, current, beta0, beta1, ilim, i_sc):
|
228 | 218 | x = np.array([np.ones_like(voltage), voltage, current]).T
|
229 | 219 | # Select points where y > ilim * i_sc to regress log(y) onto x
|
230 | 220 | 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) |
232 | 222 | coef = result[0]
|
233 | 223 | beta3 = coef[1].item()
|
234 | 224 | beta4 = coef[2].item()
|
@@ -444,7 +434,7 @@ def _cocontent_regress(v, i, voc, isc, cci):
|
444 | 434 | sx = np.vstack((s[:, 0], s[:, 1], s[:, 0] * s[:, 1], s[:, 0] * s[:, 0],
|
445 | 435 | s[:, 1] * s[:, 1], col1)).T
|
446 | 436 |
|
447 |
| - gamma = np.linalg.lstsq(sx, scc, rcond=RCOND)[0] |
| 437 | + gamma = np.linalg.lstsq(sx, scc, rcond=None)[0] |
448 | 438 | # coefficients from regression in rotated coordinates
|
449 | 439 |
|
450 | 440 | # Principle components transformation steps
|
@@ -473,5 +463,5 @@ def _cocontent_regress(v, i, voc, isc, cci):
|
473 | 463 |
|
474 | 464 | # translate from coefficients in rotated space (gamma) to coefficients in
|
475 | 465 | # 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] |
477 | 467 | return beta
|
0 commit comments