From 46444bbc2632bc7838dcd40830ffe4db5b2f774e Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 16 Jul 2015 22:52:08 -0400 Subject: [PATCH] STY: pep8 that slipped by the tests --- .../streamplot_demo_start_points.py | 8 ++--- lib/matplotlib/streamplot.py | 32 +++++++++---------- setup.py | 2 -- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/examples/images_contours_and_fields/streamplot_demo_start_points.py b/examples/images_contours_and_fields/streamplot_demo_start_points.py index bedb51f5cea6..02510eb8a549 100644 --- a/examples/images_contours_and_fields/streamplot_demo_start_points.py +++ b/examples/images_contours_and_fields/streamplot_demo_start_points.py @@ -20,12 +20,10 @@ seed_points = np.array([[-2, 0, 1], [-2, 0, 1]]) fig0, ax0 = plt.subplots() -strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn, start_points=seed_points.T) +strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, + cmap=plt.cm.autumn, start_points=seed_points.T) fig0.colorbar(strm.lines) ax0.plot(seed_points[0], seed_points[1], 'bo') -ax0.axis((-3,3,-3,3)) - - -#plt.show() +ax0.axis((-3, 3, -3, 3)) diff --git a/lib/matplotlib/streamplot.py b/lib/matplotlib/streamplot.py index 9c73d19ef1f1..480f02d9552f 100644 --- a/lib/matplotlib/streamplot.py +++ b/lib/matplotlib/streamplot.py @@ -137,8 +137,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, # Shift the seed points from the bottom left of the data so that # data2grid works properly. sp2 = np.asanyarray(start_points).copy() - sp2[:,0] += np.abs(x[0]) - sp2[:,1] += np.abs(y[0]) + sp2[:, 0] += np.abs(x[0]) + sp2[:, 1] += np.abs(y[0]) for xs, ys in sp2: xg, yg = dmap.data2grid(xs, ys) t = integrate(xg, yg) @@ -211,7 +211,7 @@ def __init__(self, lines, arrows, **kwargs): # Coordinate definitions -#======================== +# ======================== class DomainMap(object): """Map representing different coordinate systems. @@ -234,7 +234,7 @@ class DomainMap(object): def __init__(self, grid, mask): self.grid = grid self.mask = mask - ## Constants for conversion between grid- and mask-coordinates + # Constants for conversion between grid- and mask-coordinates self.x_grid2mask = float(mask.nx - 1) / grid.nx self.y_grid2mask = float(mask.ny - 1) / grid.ny @@ -246,8 +246,8 @@ def __init__(self, grid, mask): def grid2mask(self, xi, yi): """Return nearest space in mask-coords from given grid-coords.""" - return int((xi * self.x_grid2mask) + 0.5), \ - int((yi * self.y_grid2mask) + 0.5) + return (int((xi * self.x_grid2mask) + 0.5), + int((yi * self.y_grid2mask) + 0.5)) def mask2grid(self, xm, ym): return xm * self.x_mask2grid, ym * self.y_mask2grid @@ -457,17 +457,17 @@ def _integrate_rk12(x0, y0, dmap, f): solvers in most setups on my machine. I would recommend removing the other two to keep things simple. """ - ## This error is below that needed to match the RK4 integrator. It - ## is set for visual reasons -- too low and corners start - ## appearing ugly and jagged. Can be tuned. + # This error is below that needed to match the RK4 integrator. It + # is set for visual reasons -- too low and corners start + # appearing ugly and jagged. Can be tuned. maxerror = 0.003 - ## This limit is important (for all integrators) to avoid the - ## trajectory skipping some mask cells. We could relax this - ## condition if we use the code which is commented out below to - ## increment the location gradually. However, due to the efficient - ## nature of the interpolation, this doesn't boost speed by much - ## for quite a bit of complexity. + # This limit is important (for all integrators) to avoid the + # trajectory skipping some mask cells. We could relax this + # condition if we use the code which is commented out below to + # increment the location gradually. However, due to the efficient + # nature of the interpolation, this doesn't boost speed by much + # for quite a bit of complexity. maxds = min(1. / dmap.mask.nx, 1. / dmap.mask.ny, 0.1) ds = maxds @@ -548,7 +548,7 @@ def _euler_step(xf_traj, yf_traj, dmap, f): # Utility functions -#======================== +# ======================== def interpgrid(a, xi, yi): """Fast 2D, linear interpolation on an integer grid""" diff --git a/setup.py b/setup.py index d99ea700f1cc..912d8e2d6490 100644 --- a/setup.py +++ b/setup.py @@ -190,7 +190,6 @@ def finalize_options(self): if self.tests: self.test_args.append("--tests={names}".format(names=self.tests)) - def run(self): if self.distribution.install_requires: self.distribution.fetch_build_eggs( @@ -201,7 +200,6 @@ def run(self): self.announce('running unittests with nose') self.with_project_on_sys_path(self.run_tests) - def run_tests(self): import matplotlib matplotlib.use('agg')