示例#1
0
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))
示例#2
0
文件: fft.py 项目: daurer/afnumpy
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
示例#3
0
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))
示例#4
0
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)))
示例#5
0
def _do_append(arr, pad_chunk, axis):
    return afnp.concatenate((arr, pad_chunk.astype(arr.dtype, copy=False)),
                            axis=axis)