From 6925c42a94fb0acb15211137e0e102a433ad9bab Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Sun, 15 Oct 2017 18:58:15 +0200 Subject: [PATCH] pep8 --- wafo/kdetools/gridding.py | 2 +- wafo/misc.py | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/wafo/kdetools/gridding.py b/wafo/kdetools/gridding.py index 19dfe32..f2e3cfd 100644 --- a/wafo/kdetools/gridding.py +++ b/wafo/kdetools/gridding.py @@ -6,7 +6,6 @@ Created on 15. des. 2016 from __future__ import absolute_import, division, print_function from scipy import sparse import numpy as np -from wafo.testing import test_docstrings from itertools import product __all__ = ['accum', 'gridcount'] @@ -358,4 +357,5 @@ def gridcount(data, X, y=1): if __name__ == '__main__': + from wafo.testing import test_docstrings test_docstrings(__file__) diff --git a/wafo/misc.py b/wafo/misc.py index b8a43b8..a974ccf 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -18,7 +18,7 @@ from scipy.special import gammaln from scipy.integrate import trapz, simps import warnings from time import strftime, gmtime -from wafo.plotbackend import plotbackend +from wafo.plotbackend import plotbackend as plt import numbers try: from wafo import c_library as clib # @UnresolvedImport @@ -798,9 +798,9 @@ def detrendma(x, L): mn = x1[:2 * L + 1].mean(axis=0) y = np.empty_like(x1) - y[:L+1] = x1[:L+1] - mn + y[:L + 1] = x1[:L + 1] - mn - ix = np.r_[L+1:(n - L)] + ix = np.r_[L + 1:(n - L)] trend = ((x1[ix + L] - x1[ix - L]) / (2 * L)).cumsum(axis=0) + mn y[ix] = x1[ix] - trend y[n - L::] = x1[n - L::] - trend[-1] @@ -867,7 +867,6 @@ def _findcross(xn, method='clib'): return numba_misc.findcross(xn) - def findcross(x, v=0.0, kind=None, method='clib'): ''' Return indices to level v up and/or downcrossings of a vector @@ -2064,7 +2063,7 @@ def _discretize_linear(fun, a, b, tol=0.005, n=5): y = fun(x) y00 = interp(x, x0, y0) err = 0.5 * amax(np.abs(y00 - y) / (np.abs(y00) + np.abs(y) + _TINY + tol)) - num_tries += int(abs(err - err0) <= tol/2) + num_tries += int(abs(err - err0) <= tol / 2) return x, y @@ -2107,7 +2106,7 @@ def _discretize_adaptive(fun, a, b, tol=0.005, n=5): x = x[ix] erri = hstack((zeros(len(fx)), erri))[ix] fx = hstack((fx, fy))[ix] - num_tries += int(abs(err - err0) <= tol/2) + num_tries += int(abs(err - err0) <= tol / 2) else: break else: @@ -2140,6 +2139,8 @@ def polar2cart(theta, rho, z=None): if z is None: return x, y return x, y, z + + pol2cart = polar2cart @@ -2168,6 +2169,8 @@ def cart2polar(x, y, z=None): if z is None: return t, r return t, r, z + + cart2pol = cart2polar @@ -2568,7 +2571,7 @@ def plot_histgrm(data, bins=None, range=None, # @ReservedAssignment ''' xx, yy, limits = _histogram(data, bins, range, normed, weights, density) - return plotbackend.plot(xx, yy, lintype, limits, limits * 0) + return plt.plot(xx, yy, lintype, limits, limits * 0) def num2pistr(x, n=3, numerator_max=10, denominator_max=10):