Skip to content

Commit 8136b5e

Browse files
committed
Added rounding of aa and b in _schumaker_qspline.py, see Issue pvlib#1311
1 parent 2f08db1 commit 8136b5e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pvlib/ivtools/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ def _schumaker_qspline(x, y):
312312

313313
aa = s[:-1] - delta
314314
b = s[1:] - delta
315+
316+
# Since the above two lines can lead to numerical errors, aa and b
317+
# are rounded to 0.0 is their absolute value is small enough.
318+
aa[np.isclose(aa, 0., atol=EPS)] = 0.
319+
b[np.isclose(b, 0., atol=EPS)] = 0.
315320

316321
sbar = np.zeros(k)
317322
eta = np.zeros(k)

0 commit comments

Comments
 (0)