def testSC(self): """test that datasets are unchanged after various comression/decompressions""" obt_np = compression.decByteOffet_numpy(compression.compByteOffet_numpy(self.ds)) self.assertEqual(abs(self.ds - obt_np).max(), 0.0, "numpy algo") obt_cy = compression.decByteOffet_cython(compression.compByteOffet_numpy(self.ds)) self.assertEqual(abs(self.ds - obt_cy).max(), 0.0, "cython algo") obt_cy2 = compression.decByteOffet_cython(compression.compByteOffet_numpy(self.ds), self.ds.size) self.assertEqual(abs(self.ds - obt_cy2).max(), 0.0, "cython algo_orig") obt_we = compression.decByteOffet_weave(compression.compByteOffet_numpy(self.ds), self.ds.size) self.assertEqual(abs(self.ds - obt_we).max(), 0.0, "weave algo")
def testComp(self): """ """ ds = numpy.array([0, 128]) ref = "\x00\x80\x80\00" self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test +128") ds = numpy.array([0, -128]) ref = '\x00\x80\x80\xff' self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test -128") ds = numpy.array([10, -128]) ref = '\n\x80v\xff' self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test +10 -128") self.assertEqual(self.ref, compression.compByteOffet_numpy(self.ds) , "test larger")
def testSC(self): """test that datasets are unchanged after various comression/decompressions""" obt_np = compression.decByteOffet_numpy( compression.compByteOffet_numpy(self.ds)) self.assertEqual(abs(self.ds - obt_np).max(), 0.0, "numpy algo") obt_cy = compression.decByteOffet_cython( compression.compByteOffet_numpy(self.ds)) self.assertEqual(abs(self.ds - obt_cy).max(), 0.0, "cython algo") obt_cy2 = compression.decByteOffet_cython( compression.compByteOffet_numpy(self.ds), self.ds.size) self.assertEqual(abs(self.ds - obt_cy2).max(), 0.0, "cython algo_orig") obt_we = compression.decByteOffet_weave( compression.compByteOffet_numpy(self.ds), self.ds.size) self.assertEqual(abs(self.ds - obt_we).max(), 0.0, "weave algo")
def testComp(self): """ """ ds = numpy.array([0, 128]) ref = "\x00\x80\x80\00" self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test +128") ds = numpy.array([0, -128]) ref = '\x00\x80\x80\xff' self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test -128") ds = numpy.array([10, -128]) ref = '\n\x80v\xff' self.assertEqual(ref, compression.compByteOffet_numpy(ds), "test +10 -128") self.assertEqual(self.ref, compression.compByteOffet_numpy(self.ds), "test larger")