From d3583b8e53def18428a12c8b796b2628c1d7cbc9 Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Sun, 15 Oct 2017 22:46:14 +0200 Subject: [PATCH] Fixed failures --- wafo/kdetools/gridding.py | 4 ++-- wafo/misc.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wafo/kdetools/gridding.py b/wafo/kdetools/gridding.py index f2e3cfd..dec00da 100644 --- a/wafo/kdetools/gridding.py +++ b/wafo/kdetools/gridding.py @@ -215,7 +215,7 @@ def accum(accmap, a, func=None, shape=None, fill_value=0, dtype=None): # Create the output array. out = np.empty(shape, dtype=dtype) - for s in product(*[np.arange(k) for k in shape]): + for s in product(*[list(range(k)) for k in shape]): if vals[s] == []: out[s] = fill_value else: @@ -249,7 +249,7 @@ def _gridcount_nd(acfun, data, x, y, w, binx): c = np.reshape(c / w, c_shape, order='F') - T = np.arange(d).tolist() + T = list(range(d)) T[1], T[0] = T[0], T[1] # make sure c is stored in the same way as meshgrid c = c.transpose(*T) diff --git a/wafo/misc.py b/wafo/misc.py index a974ccf..1b14dfb 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -204,13 +204,15 @@ def piecewise(condlist, funclist, xi=None, fill_value=0.0, args=(), **kw): if xi is None: arrays = () dtype = np.result_type(*funclist) + shape = condlist[0].shape else: if not isinstance(xi, tuple): xi = (xi,) arrays = np.broadcast_arrays(*xi) dtype = np.result_type(*arrays) + shape = arrays[0].shape - out = valarray(condlist[0].shape, fill_value, dtype) + out = valarray(shape, fill_value, dtype) for cond, func in zip(condlist, funclist): if cond.any(): if isinstance(func, collections.Callable):