Exemple #1
0
def test_me_case_1():
    a = ny.array([[10, float('NaN'), 4], [float('NaN'), 2, 1]])

    na = ny.array(a)
    ans = ny.nanstd(na, axis=0)
    out = ny.zeros_like(ans)
    dst = ny.nanstd(na, axis=0, out=out)
    assert_array_almost_equal(dst.get(), out.get())
Exemple #2
0
def ca5(arg):
    d = arg[0]
    t = arg[1]
    a = arg[2]
    k = arg[4]

    ss = 1
    for x in d:
        ss *= x

    if t == 'int32' or t == 'int64' or t == 'uint32' or t == 'uint64':
        seed = [random.randint(1, ss * ss) for i in range(ss)]
    elif t == 'float64' or t == 'float32':
        seed = [random.random() for i in range(ss)]
    else:
        pass

    na = np.array(seed)
    ans = np.nanstd(na, axis=a, keepdims=k)
    np.save(fil, ans)

    ok = np.load(fil)
    dst = ny.nanstd(na, axis=a, keepdims=k)

    return ok, dst
Exemple #3
0
def test_me_case_3():
    ny_a = ny.array([[10, float('NaN'), 4], [3, 2, 1]])
    np_a = np.array([[10, float('NaN'), 4], [3, 2, 1]])

    ny_ans = ny.nanstd(ny_a, ddof=1)
    np_ans = np.nanstd(np_a, ddof=1)

    assert_array_almost_equal(ny_ans.get(), np_ans)
Exemple #4
0
def ca1(arg):
    d = arg[0]

    na = np.array(d)
    src = np.nanstd(na)
    np.save(fil, src)

    ok = np.load(fil)
    dst = ny.nanstd(na)

    return ok, dst
Exemple #5
0
def ca2(arg):
    d = arg[0]
    a = arg[2]

    na = np.array(d)
    src = np.nanstd(na, axis=a)
    np.save(fil, src)

    ok = np.load(fil)
    dst = ny.nanstd(na, axis=a)

    return ok, dst
Exemple #6
0
def ca4(arg):
    d = arg[0]
    t = arg[1]
    a = arg[2]

    ss = 1
    for x in d:
        ss *= x

    if t == 'int32' or t == 'int64' or t == 'uint32' or t == 'uint64':
        seed = [random.randint(1, ss * ss) for i in range(ss)]
    elif t == 'float64' or t == 'float32':
        seed = [random.random() for i in range(ss)]
    else:
        pass

    na = ny.array(seed)
    ans = ny.nanstd(na, axis=a)
    out = ny.zeros_like(ans)
    dst = ny.nanstd(na, axis=a, out=out)

    return dst, out