|
23 | 23 | def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
|
24 | 24 | cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
|
25 | 25 | minlength=0.1, maxlength=4.0, transform=None, zorder=None,
|
26 |
| - start_points=None,integration_direction='both'): |
| 26 | + start_points=None, integration_direction='both'): |
27 | 27 | """Draws streamlines of a vector flow.
|
28 | 28 |
|
29 | 29 | *x*, *y* : 1d arrays
|
@@ -100,15 +100,15 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
|
100 | 100 | line_kw = {}
|
101 | 101 | arrow_kw = dict(arrowstyle=arrowstyle, mutation_scale=10 * arrowsize)
|
102 | 102 |
|
103 |
| - if not integration_direction in ['both','forward','backward']: |
104 |
| - errstr = "Integration direction '%s' not recognised." % integration_direction |
| 103 | + if integration_direction not in ['both', 'forward', 'backward']: |
| 104 | + errstr = "Integration direction " \ |
| 105 | + "'%s' not recognised." % integration_direction |
105 | 106 | errstr += "Expected 'both', 'forward' or 'backward'."
|
106 | 107 | raise ValueError(errstr)
|
107 | 108 |
|
108 |
| - if integration_direction=='both': |
| 109 | + if integration_direction == 'both': |
109 | 110 | maxlength /= 2.
|
110 | 111 |
|
111 |
| - |
112 | 112 | use_multicolor_lines = isinstance(color, np.ndarray)
|
113 | 113 | if use_multicolor_lines:
|
114 | 114 | if color.shape != grid.shape:
|
@@ -140,7 +140,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
|
140 | 140 | u = np.ma.masked_invalid(u)
|
141 | 141 | v = np.ma.masked_invalid(v)
|
142 | 142 |
|
143 |
| - integrate = get_integrator(u, v, dmap, minlength, maxlength, integration_direction) |
| 143 | + integrate = get_integrator(u, v, dmap, minlength, maxlength, |
| 144 | + integration_direction) |
144 | 145 |
|
145 | 146 | trajectories = []
|
146 | 147 | if start_points is None:
|
@@ -455,13 +456,13 @@ def integrate(x0, y0):
|
455 | 456 | dmap.start_trajectory(x0, y0)
|
456 | 457 | except InvalidIndexError:
|
457 | 458 | return None
|
458 |
| - if integration_direction in ['both','backward']: |
| 459 | + if integration_direction in ['both', 'backward']: |
459 | 460 | s, xt, yt = _integrate_rk12(x0, y0, dmap, backward_time, maxlength)
|
460 | 461 | stotal += s
|
461 | 462 | x_traj += xt[::-1]
|
462 | 463 | y_traj += yt[::-1]
|
463 | 464 |
|
464 |
| - if integration_direction in ['both','forward']: |
| 465 | + if integration_direction in ['both', 'forward']: |
465 | 466 | dmap.reset_start_point(x0, y0)
|
466 | 467 | s, xt, yt = _integrate_rk12(x0, y0, dmap, forward_time, maxlength)
|
467 | 468 | if len(x_traj) > 0:
|
|
0 commit comments