diff --git a/wafo/misc.py b/wafo/misc.py index c113601..591ff91 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -162,7 +162,7 @@ def piecewise(condlist, funclist, xi=None, fill_value=0.0, args=(), **kw): if len(condlist) == len(funclist)-1: condlist.append(otherwise_condition(condlist)) if xi is None: - arrays = condlist + arrays = () dtype = np.result_type(*funclist) else: if not isinstance(xi, tuple): @@ -170,7 +170,7 @@ def piecewise(condlist, funclist, xi=None, fill_value=0.0, args=(), **kw): arrays = np.broadcast_arrays(*xi) dtype = np.result_type(*arrays) - out = valarray(arrays[0].shape, fill_value, dtype) + out = valarray(condlist[0].shape, fill_value, dtype) for cond, func in zip(condlist, funclist): if isinstance(func, collections.Callable): temp = tuple(np.extract(cond, arr) for arr in arrays) + args