From fbd6510d58a47ea0d166c48a82793f05425406e4 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 18 Aug 2013 11:51:25 -0600 Subject: STY: Giant comma spacing fixup. Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum. --- numpy/ma/bench.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'numpy/ma/bench.py') diff --git a/numpy/ma/bench.py b/numpy/ma/bench.py index b8d085130..75e6d90c8 100644 --- a/numpy/ma/bench.py +++ b/numpy/ma/bench.py @@ -17,8 +17,8 @@ import numpy #####--------------------------------------------------------------------------- # Small arrays .................................. -xs = numpy.random.uniform(-1,1,6).reshape(2,3) -ys = numpy.random.uniform(-1,1,6).reshape(2,3) +xs = numpy.random.uniform(-1, 1, 6).reshape(2, 3) +ys = numpy.random.uniform(-1, 1, 6).reshape(2, 3) zs = xs + 1j * ys m1 = [[True, False, False], [False, False, True]] m2 = [[True, False, True], [False, False, True]] @@ -26,8 +26,8 @@ nmxs = numpy.ma.array(xs, mask=m1) nmys = numpy.ma.array(ys, mask=m2) nmzs = numpy.ma.array(zs, mask=m1) # Big arrays .................................... -xl = numpy.random.uniform(-1,1,100*100).reshape(100,100) -yl = numpy.random.uniform(-1,1,100*100).reshape(100,100) +xl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100) +yl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100) zl = xl + 1j * yl maskx = xl > 0.8 masky = yl < -0.8 @@ -42,7 +42,7 @@ nmzl = numpy.ma.array(zl, mask=maskx) def timer(s, v='', nloop=500, nrep=3): units = ["s", "ms", "µs", "ns"] scaling = [1, 1e3, 1e6, 1e9] - print("%s : %-50s : " % (v,s), end=' ') + print("%s : %-50s : " % (v, s), end=' ') varnames = ["%ss,nm%ss,%sl,nm%sl" % tuple(x*4) for x in 'xyz'] setup = 'from __main__ import numpy, ma, %s' % ','.join(varnames) Timer = timeit.Timer(stmt=s, setup=setup) @@ -64,11 +64,11 @@ def compare_functions_1v(func, nloop=500, funcname = func.__name__ print("-"*50) print("%s on small arrays" % funcname) - module, data = "numpy.ma","nmxs" + module, data = "numpy.ma", "nmxs" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) # print("%s on large arrays" % funcname) - module, data = "numpy.ma","nmxl" + module, data = "numpy.ma", "nmxl" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) return @@ -92,11 +92,11 @@ def compare_functions_2v(func, nloop=500, test=True, funcname = func.__name__ print("-"*50) print("%s on small arrays" % funcname) - module, data = "numpy.ma","nmxs,nmys" + module, data = "numpy.ma", "nmxs,nmys" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) # print("%s on large arrays" % funcname) - module, data = "numpy.ma","nmxl,nmyl" + module, data = "numpy.ma", "nmxl,nmyl" timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop) return @@ -139,28 +139,28 @@ if __name__ == '__main__': compare_functions_2v(numpy.divide) compare_functions_2v(numpy.power) #.................................................................... - compare_methods('ravel','', nloop=1000) - compare_methods('conjugate','','z', nloop=1000) - compare_methods('transpose','', nloop=1000) - compare_methods('compressed','', nloop=1000) - compare_methods('__getitem__','0', nloop=1000) - compare_methods('__getitem__','(0,0)', nloop=1000) - compare_methods('__getitem__','[0,-1]', nloop=1000) - compare_methods('__setitem__','0, 17', nloop=1000, test=False) - compare_methods('__setitem__','(0,0), 17', nloop=1000, test=False) + compare_methods('ravel', '', nloop=1000) + compare_methods('conjugate', '', 'z', nloop=1000) + compare_methods('transpose', '', nloop=1000) + compare_methods('compressed', '', nloop=1000) + compare_methods('__getitem__', '0', nloop=1000) + compare_methods('__getitem__', '(0,0)', nloop=1000) + compare_methods('__getitem__', '[0,-1]', nloop=1000) + compare_methods('__setitem__', '0, 17', nloop=1000, test=False) + compare_methods('__setitem__', '(0,0), 17', nloop=1000, test=False) #.................................................................... print("-"*50) print("__setitem__ on small arrays") - timer('nmxs.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ',nloop=10000) + timer('nmxs.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ', nloop=10000) print("-"*50) print("__setitem__ on large arrays") - timer('nmxl.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ',nloop=10000) + timer('nmxl.__setitem__((-1,0),numpy.ma.masked)', 'numpy.ma ', nloop=10000) #.................................................................... print("-"*50) print("where on small arrays") - timer('numpy.ma.where(nmxs>2,nmxs,nmys)', 'numpy.ma ',nloop=1000) + timer('numpy.ma.where(nmxs>2,nmxs,nmys)', 'numpy.ma ', nloop=1000) print("-"*50) print("where on large arrays") - timer('numpy.ma.where(nmxl>2,nmxl,nmyl)', 'numpy.ma ',nloop=100) + timer('numpy.ma.where(nmxl>2,nmxl,nmyl)', 'numpy.ma ', nloop=100) -- cgit v1.2.1