Skip to content

Commit 2087979

Browse files
mikofskiwholmgren
authored andcommitted
do not check brentq is NotImplemented (#593)
* related to #556 * if brentq can't be imported it will raise a `NotImplementedError` alread * lgtm says it's better for a callable to have a consistent API * that's why we changed it the not-imported `brentq` from `NotImplemented` to a callable, b/c `brentq` is usually callable * but we forgot the original code has a check if `brentq` is `NotImplemented`, so we can remove that now
1 parent ef48363 commit 2087979

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

pvlib/singlediode.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ def fv(x, v, *a):
209209
return bishop88(x, *a)[1] - v
210210

211211
if method.lower() == 'brentq':
212-
if brentq is NotImplemented:
213-
raise ImportError('This function requires scipy')
214212
# first bound the search using voc
215213
voc_est = estimate_voc(photocurrent, saturation_current, nNsVth)
216214

@@ -275,9 +273,6 @@ def fi(x, i, *a):
275273
return bishop88(x, *a)[0] - i
276274

277275
if method.lower() == 'brentq':
278-
if brentq is NotImplemented:
279-
raise ImportError('This function requires scipy')
280-
281276
# brentq only works with scalar inputs, so we need a set up function
282277
# and np.vectorize to repeatedly call the optimizer with the right
283278
# arguments for possible array input
@@ -336,8 +331,6 @@ def fmpp(x, *a):
336331
return bishop88(x, *a, gradients=True)[6]
337332

338333
if method.lower() == 'brentq':
339-
if brentq is NotImplemented:
340-
raise ImportError('This function requires scipy')
341334
# break out arguments for numpy.vectorize to handle broadcasting
342335
vec_fun = np.vectorize(
343336
lambda voc, iph, isat, rs, rsh, gamma:

0 commit comments

Comments
 (0)