Skip to content

Commit

Permalink
Catch divide-by-zero in step calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysyu committed Sep 2, 2012
1 parent 4bbd671 commit 0d7a1d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ def _integrate_rk12(x0, y0, dmap, f):
stotal += ds

# recalculate stepsize based on step error
ds = min(maxds, 0.85 * ds * (maxerror/error)**0.5)
if error == 0:
ds = maxds
else:
ds = min(maxds, 0.85 * ds * (maxerror/error)**0.5)

return stotal, xf_traj, yf_traj

Expand Down

0 comments on commit 0d7a1d1

Please sign in to comment.