def test_concatenate(): b = numpy.random.random((2, 3)) a = afnumpy.array(b) iassert(afnumpy.concatenate(a), numpy.concatenate(b)) iassert(afnumpy.concatenate((a, a)), numpy.concatenate((b, b))) iassert(afnumpy.concatenate((a, a), axis=1), numpy.concatenate((b, b), axis=1))
def ifftshift(x, axes=None): tmp = afnumpy.asarray(x) ndim = len(tmp.shape) if axes is None: axes = list(range(ndim)) elif isinstance(axes, numbers.Integral): axes = (axes,) y = tmp for k in axes: n = tmp.shape[k] p2 = n-(n+1)//2 mylist = afnumpy.concatenate((afnumpy.arange(p2, n), afnumpy.arange(p2))) y = afnumpy.take(y, mylist, k) return y
def test_concatenate(): b = numpy.random.random((2,3)) a = afnumpy.array(b) iassert(afnumpy.concatenate(a), numpy.concatenate(b)) iassert(afnumpy.concatenate((a,a)), numpy.concatenate((b,b))) iassert(afnumpy.concatenate((a,a),axis=1), numpy.concatenate((b,b),axis=1))
def test_concatenate_xfail(): b = np.array([[1, 2], [3, 4]]) d = np.array([[5, 6]]) a = afnumpy.array(b) c = afnumpy.array(d) fassert(afnumpy.concatenate((a, c)), numpy.concatenate((b, d)))
def _do_append(arr, pad_chunk, axis): return afnp.concatenate((arr, pad_chunk.astype(arr.dtype, copy=False)), axis=axis)