コード例 #1
0
 def test_deflate(self):
     cb = Checkerboard()
     param_vec = matrix([10,20], float).T
     cb.inflate( param_vec )
     result = cb.deflate()
     print ""
     print result
     self.assertAlmostEqual(numpy.linalg.norm(result - param_vec), 0.0, 6)
コード例 #2
0
 def test_params_to_config(self):
     cb = Checkerboard( {"corners_x": 2,
                         "corners_y": 3,
                         "spacing_x": 10,
                         "spacing_y": 20 } )
     config = cb.params_to_config( matrix([5,6], float).T )
     self.assertEquals( config["corners_x"], 2)
     self.assertEquals( config["corners_y"], 3)
     self.assertAlmostEquals( config["spacing_x"], 5, 6)
     self.assertAlmostEquals( config["spacing_y"], 6, 6)
コード例 #3
0
 def test_generate_points(self):
     cb = Checkerboard({"corners_x":  2,
                         "corners_y": 3,
                         "spacing_x": 10,
                         "spacing_y": 20 })
     result = cb.generate_points()
     expected = matrix( [ [ 0, 10,   0, 10,  0, 10],
                          [ 0,  0,  20, 20, 40, 40],
                          [ 0,  0,   0,  0,  0,  0],
                          [ 1,  1,   1,  1,  1,  1] ], float)
     print ""
     print result
     self.assertAlmostEqual(numpy.linalg.norm(result - expected), 0.0, 6)
コード例 #4
0
    def test_init(self):
        cb = Checkerboard( {"corners_x": 2,
                            "corners_y": 3,
                            "spacing_x": 10,
                            "spacing_y": 20 } )

        self.assertEqual(cb._corners_x, 2)
        self.assertEqual(cb._corners_y, 3)
        self.assertEqual(cb._spacing_x, 10)
        self.assertEqual(cb._spacing_y, 20)
コード例 #5
0
 def test_get_length(self):
     cb = Checkerboard()
     self.assertEqual(cb.get_length(), 2)