def test_algorithms(self):
        expl_algo = ExplicitPermutationsAlgorithm(permutations=[[0, 1, 2], [1, 2, 3]])
        expl_algo2 = ExplicitPermutationsAlgorithm.from_dict(expl_algo.as_dict)
        self.assertEqual(expl_algo.permutations, expl_algo2.permutations)

        sepplane_algos_oct = allcg["O:6"].algorithms
        self.assertEqual(len(sepplane_algos_oct[0].safe_separation_permutations()), 24)
        self.assertEqual(len(sepplane_algos_oct[1].safe_separation_permutations()), 36)

        sepplane_algos_oct_0 = SeparationPlane.from_dict(sepplane_algos_oct[0].as_dict)
        self.assertEqual(sepplane_algos_oct[0].plane_points, sepplane_algos_oct_0.plane_points)
        self.assertEqual(sepplane_algos_oct[0].mirror_plane, sepplane_algos_oct_0.mirror_plane)
        self.assertEqual(sepplane_algos_oct[0].ordered_plane, sepplane_algos_oct_0.ordered_plane)
        self.assertEqual(sepplane_algos_oct[0].point_groups, sepplane_algos_oct_0.point_groups)
        self.assertEqual(
            sepplane_algos_oct[0].ordered_point_groups,
            sepplane_algos_oct_0.ordered_point_groups,
        )
        self.assertTrue(
            all(
                [
                    np.array_equal(
                        perm,
                        sepplane_algos_oct_0.explicit_optimized_permutations[iperm],
                    )
                    for iperm, perm in enumerate(sepplane_algos_oct[0].explicit_optimized_permutations)
                ]
            )
        )

        self.assertEqual(
            sepplane_algos_oct[0].__str__(),
            "Separation plane algorithm with the following reference separation :\n[[4]] | [[0, 2, 1, 3]] | [[5]]",
        )
示例#2
0
    def test_algorithms(self):
        expl_algo = ExplicitPermutationsAlgorithm(
            permutations=[[0, 1, 2], [1, 2, 3]])
        expl_algo2 = ExplicitPermutationsAlgorithm.from_dict(expl_algo.as_dict)
        self.assertEqual(expl_algo.permutations, expl_algo2.permutations)

        sepplane_algos_oct = allcg['O:6'].algorithms
        self.assertEqual(
            len(sepplane_algos_oct[0].safe_separation_permutations()), 24)
        self.assertEqual(
            len(sepplane_algos_oct[1].safe_separation_permutations()), 36)

        sepplane_algos_oct_0 = SeparationPlane.from_dict(
            sepplane_algos_oct[0].as_dict)
        self.assertEqual(sepplane_algos_oct[0].plane_points,
                         sepplane_algos_oct_0.plane_points)
        self.assertEqual(sepplane_algos_oct[0].mirror_plane,
                         sepplane_algos_oct_0.mirror_plane)
        self.assertEqual(sepplane_algos_oct[0].ordered_plane,
                         sepplane_algos_oct_0.ordered_plane)
        self.assertEqual(sepplane_algos_oct[0].point_groups,
                         sepplane_algos_oct_0.point_groups)
        self.assertEqual(sepplane_algos_oct[0].ordered_point_groups,
                         sepplane_algos_oct_0.ordered_point_groups)
        self.assertEqual(sepplane_algos_oct[0].explicit_optimized_permutations,
                         sepplane_algos_oct_0.explicit_optimized_permutations)

        self.assertEqual(
            sepplane_algos_oct[0].__str__(),
            'Separation plane algorithm with the following reference separation :\n'
            '[[4]] | [[0, 2, 1, 3]] | [[5]]')
    def test_algorithms(self):
        expl_algo = ExplicitPermutationsAlgorithm(permutations=[[0, 1, 2], [1, 2, 3]])
        expl_algo2 = ExplicitPermutationsAlgorithm.from_dict(expl_algo.as_dict)
        self.assertEqual(expl_algo.permutations, expl_algo2.permutations)

        sepplane_algos_oct = allcg['O:6'].algorithms
        self.assertEqual(len(sepplane_algos_oct[0].safe_separation_permutations()), 24)
        self.assertEqual(len(sepplane_algos_oct[1].safe_separation_permutations()), 36)

        sepplane_algos_oct_0 = SeparationPlane.from_dict(sepplane_algos_oct[0].as_dict)
        self.assertEqual(sepplane_algos_oct[0].plane_points, sepplane_algos_oct_0.plane_points)
        self.assertEqual(sepplane_algos_oct[0].mirror_plane, sepplane_algos_oct_0.mirror_plane)
        self.assertEqual(sepplane_algos_oct[0].ordered_plane, sepplane_algos_oct_0.ordered_plane)
        self.assertEqual(sepplane_algos_oct[0].point_groups, sepplane_algos_oct_0.point_groups)
        self.assertEqual(sepplane_algos_oct[0].ordered_point_groups, sepplane_algos_oct_0.ordered_point_groups)
        self.assertEqual(sepplane_algos_oct[0].explicit_optimized_permutations,
                         sepplane_algos_oct_0.explicit_optimized_permutations)

        self.assertEqual(sepplane_algos_oct[0].__str__(),
                         'Separation plane algorithm with the following reference separation :\n'
                         '[[4]] | [[0, 2, 1, 3]] | [[5]]')