def deactivated_test_bitshuffle(self): d = np.arange(128, dtype=np.uint16) t1 = ext.bitshuffle(d) #print t1 t2 = ext.bitunshuffle(t1) #print t2 self.assertTrue(np.all(t2.view(np.uint8) == d.view(np.uint8)))
def test_circle(self): nmax = 100000 reps = 20 for dtype in TEST_DTYPES: itemsize = np.dtype(dtype).itemsize nbyte_max = nmax * itemsize dbuf = random.randint(0, 255, nbyte_max).astype(np.uint8) dbuf = dbuf.view(dtype) for ii in range(reps): n = random.randint(0, nmax, 1)[0] data = dbuf[:n] shuff = ext.bitshuffle(data) out = ext.bitunshuffle(shuff) self.assertTrue(out.dtype is data.dtype) self.assertTrue(np.all(data.view(np.uint8) == out.view(np.uint8)))
def test_circle(self): nmax = 100000 reps = 20 for dtype in TEST_DTYPES: itemsize = np.dtype(dtype).itemsize nbyte_max = nmax * itemsize dbuf = random.randint(0, 255, nbyte_max).astype(np.uint8) dbuf = dbuf.view(dtype) for ii in range(reps): n = random.randint(0, nmax, 1) data = dbuf[:n] shuff = ext.bitshuffle(data) out = ext.bitunshuffle(shuff) self.assertTrue(out.dtype is data.dtype) self.assertTrue( np.all(data.view(np.uint8) == out.view(np.uint8)))
def test_10b_bitunshuffle_64(self): self.case = "bitunshuffle 64" pre_trans = self.data.view(np.float64) self.data = ext.bitshuffle(pre_trans, BLOCK) self.fun = lambda x: ext.bitunshuffle(x, BLOCK) self.check_data = pre_trans
def test_10a_bitshuffle_64(self): self.case = "bitshuffle 64" self.data = self.data.view(np.float64) self.fun = lambda x: ext.bitshuffle(x, BLOCK)