Skip to content

Commit b90b413

Browse files
Actually handle Zero division
1 parent e7128ec commit b90b413

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SALib/analyze/radial_ee.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ def analyze(problem: Dict, X: np.array, Y: np.array, sample_sets: int,
8080
x_tmp = (X_base[:, i] - X[pos::nth, i])
8181

8282
# Convert zero division nan to 0
83-
ee[:, i] = np.nan_to_num((Y_base - Y[pos::nth]) / x_tmp)
83+
try:
84+
ee[:, i] = (Y_base - Y[pos::nth]) / x_tmp
85+
except ZeroDivisionError:
86+
ee[:, i] = 0.0
8487
# End for
8588

8689
Si = ResultDict((k, [None] * num_vars)

0 commit comments

Comments
 (0)