예제 #1
0
def test_ndim3():
    shape = (13, 3)
    l = PackedTable(shape, ndim=1)
    l1, l2 = l.split(2)
    assert_equal(len(l1), 7)
    assert_equal(l1.shape, shape)
    assert_equal(len(l2), 6)
    assert_equal(l2.shape, shape)
예제 #2
0
 def func(n, s, m):
     if s is not Ellipsis:
         tmp = np.ones(n, bool)
         tmp[s] = False
         s = tmp
     layout = PackedTable(n, selection=s, val=np.arange(n)*2.)
     slices = layout.split(m)
     assert_eq(len(slices), m)
     o = np.zeros(layout.shape, int)
     v = np.full(layout.shape, np.nan)
     for s in slices:
         o[s._index] += 1
         v[s._index] = s.val
     o[o == 0] = -1
     assert_same(o, layout.unpack(1))
     assert_same(v, layout.all.val)
     assert_same(np.concatenate([_.val for _ in slices]), layout.val)