Skip to content

Commit

Permalink
Actually handle Zero division
Browse files Browse the repository at this point in the history
force return value again
  • Loading branch information
ConnectedSystems committed Sep 9, 2020
1 parent e7128ec commit da99fda
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SALib/analyze/radial_ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def analyze(problem: Dict, X: np.array, Y: np.array, sample_sets: int,
x_tmp = (X_base[:, i] - X[pos::nth, i])

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

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

0 comments on commit da99fda

Please sign in to comment.