def abs_diff_cube_inTn6_outTn6(self): e = self.epsilon cube = cb.abs_diff_cube(self.c0, self.c1, in_threshold=1e-6, out_threshold=1e-6) cube_cmp = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) for v0, v1 in zip(self.c0, self.c1): self.assertAlmostEqual(v0, v1)
def diff_cubes(self, kind, shape, dtype, cube_l, cube_r, buffer_size): diff_info_cubes = cb.diff_info(cube_l, cube_r) stats_info_cube_l = cb.stats_info(cube_l) stats_info_cube_r = cb.stats_info(cube_r) stats_info_cube_abs = cb.stats_info(cb.abs_diff_cube(cube_l, cube_r)) stats_info_cube_rel = cb.stats_info(cb.rel_diff_cube(cube_l, cube_r)) self.assertAlmostEqualStatsInfo(diff_info_cubes.left, stats_info_cube_l) self.assertAlmostEqualStatsInfo(diff_info_cubes.right, stats_info_cube_r) self.assertAlmostEqualStatsInfo(diff_info_cubes.abs_diff, stats_info_cube_abs) self.assertAlmostEqualStatsInfo(diff_info_cubes.rel_diff, stats_info_cube_rel) cube_l_filename_format = "cube_l_{kind}_{{shape}}_{{dtype}}.{{format}}".format(kind=kind) cube_l_filename = cube_l_filename_format.format(shape=shape, dtype=dtype, format='raw') cube_r_filename_format = "cube_r_{kind}_{{shape}}_{{dtype}}.{{format}}".format(kind=kind) cube_r_filename = cube_r_filename_format.format(shape=shape, dtype=dtype, format='raw') cube_l.tofile(cube_l_filename) cube_r.tofile(cube_r_filename) diff_info_oc = cb.diff_files(cube_l_filename, cube_r_filename, shape=shape, dtype=dtype, out_of_core=False) self.assertEqual(diff_info_oc, diff_info_cubes) diff_info_ooc = cb.diff_files(cube_l_filename, cube_r_filename, shape=shape, dtype=dtype, out_of_core=True, buffer_size=buffer_size, progress_frequency=-1.0) self.assertEqual(diff_info_oc, diff_info_cubes) diff_info_oc_report = diff_info_oc.report() diff_info_ooc_report = diff_info_ooc.report() self.assertEqual(diff_info_oc_report, diff_info_ooc_report)
def abs_diff_cube_t0(self): e = self.epsilon cube = cb.abs_diff_cube(self.c0, self.c1) cube_cmp = np.array([0.0, e, e, 0.0, e, e]) for v0, v1 in zip(self.c0, self.c1): self.assertAlmostEqual(v0, v1)