Esempio n. 1
0
    def test_center_into_constraints_complex(self):
        '''test that center_into_constraints doesn't modify the stars'''

        mode = make_debug_mode()
        array = np.array

        star = Star(HylaaSettings(0.01, 2.0),
                    array([-0.11060623, -0.62105371]),
                    array([[-0.12748444, -6.33082449],
                           [0.06330825, -0.3807174]]),
                    [
                        LinearConstraint(array([1., 0.]), -0.95),
                        LinearConstraint(array([-1., 0.]), 1.05),
                        LinearConstraint(array([0., 1.]), 0.1),
                        LinearConstraint(array([0., -1.]), 0.1),
                        LinearConstraint(array([6.33082449, 0.3807174]),
                                         -0.6210537093866693),
                        LinearConstraint(array([0.12748444, -0.06330825]),
                                         -0.11060623185202963),
                        LinearConstraint(array([-0.12748444, 0.06330825]),
                                         1.1106062318520296)
                    ],
                    None,
                    mode,
                    extra_init=(None, 20, 0))

        star2 = star.clone()
        star2.center_into_constraints(star2.vector_to_star_basis(star2.center))

        self.check_stars_equal(star, star2)
Esempio n. 2
0
    def test_clone(self):
        'test that clone is working as expected'

        mode = make_debug_mode()

        array = np.array

        star = Star(
            HylaaSettings(0.1, 1.0),
            array([-0.11060623, -0.62105371]),
            array([[-0.12748444, -6.33082449], [0.06330825, -0.3807174]]), [
                LinearConstraint(array([1., 0.]), -0.76877967521149881),
                LinearConstraint(array([-1., 0.]), 0.8687796752114989),
                LinearConstraint(array([0., 1.]), -1.2821810092782602),
                LinearConstraint(array([0., -1.]), 1.4821810092782604)
            ],
            None,
            mode,
            extra_init=(None, 20, 0))

        self.check_stars_equal(star, star.clone())
Esempio n. 3
0
    def test_center_into_constraints(self):
        '''test that center_into_constraints doesn't modify the stars'''

        mode = make_debug_mode()
        array = np.array

        star = Star(HylaaSettings(0.1, 1.0),
                    array([5.0, 5.0]),
                    array([[0.707, 0.707], [-0.707, 0.707]]), [
                        LinearConstraint(array([1., 0.]), 1),
                        LinearConstraint(array([-1., 0.]), 0.),
                        LinearConstraint(array([0., 1.]), 1),
                        LinearConstraint(array([0., -1.]), 0)
                    ],
                    None,
                    mode,
                    extra_init=(None, 20, 0))

        star2 = star.clone()
        star2.center_into_constraints(star2.vector_to_star_basis(star2.center))

        self.check_stars_equal(star, star2)