예제 #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
파일: test_core.py 프로젝트: daurer/afnumpy
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)