Skip to content

Commit

Permalink
STY: pep8 that slipped by the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Jul 17, 2015
1 parent 6ee9a4d commit 46444bb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
32 changes: 16 additions & 16 deletions lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -211,7 +211,7 @@ def __init__(self, lines, arrows, **kwargs):


# Coordinate definitions
#========================
# ========================

class DomainMap(object):
"""Map representing different coordinate systems.
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"""
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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')
Expand Down

0 comments on commit 46444bb

Please sign in to comment.