@@ -2268,7 +2268,8 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2268
2268
# wrap it so it returns nan
2269
2269
i_from_v_fun = singlediode_methods .returns_nan ()(i_from_v_fun )
2270
2270
# find the right size and shape for returns
2271
- args = (voltage , photocurrent , resistance_shunt )
2271
+ args = (voltage , photocurrent , saturation_current , resistance_series ,
2272
+ resistance_shunt , nNsVth )
2272
2273
size = 0
2273
2274
shape = None
2274
2275
for n , arg in enumerate (args ):
@@ -2288,15 +2289,18 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2288
2289
size = this_size
2289
2290
if this_shape is not None :
2290
2291
shape = this_shape
2292
+ else :
2293
+ msg = ('Argument: "%s" is different size from other arguments'
2294
+ ' (%d > %d). All arguments must be the same size or'
2295
+ ' scalar.' ) % (arg , this_size , size )
2296
+ raise ValueError (msg )
2291
2297
if size <= 1 :
2292
- I = i_from_v_fun (voltage , photocurrent , saturation_current ,
2293
- resistance_series , resistance_shunt , nNsVth )
2298
+ I = i_from_v_fun (* args )
2294
2299
if shape is not None :
2295
2300
I = np .tile (I , shape )
2296
2301
else :
2297
2302
vecfun = np .vectorize (i_from_v_fun )
2298
- I = vecfun (voltage , photocurrent , saturation_current ,
2299
- resistance_series , resistance_shunt , nNsVth )
2303
+ I = vecfun (* args )
2300
2304
if np .isnan (I ).any () and size <= 1 :
2301
2305
I = np .repeat (I , size )
2302
2306
if shape is not None :
0 commit comments