Example #1
0
    def test_set_loc(self):
        for ct in self.C_TYPES:
            print(ct)

            l = Landmark(c_type=ct)
            l.loc = [[1], [1], [1]]
            numpy.testing.assert_equal(l.loc, [[1], [1], [1]])

            l.loc = [[9.12], [4.1], [8.3]]
            numpy.testing.assert_almost_equal(l.loc, [[9.12], [4.1], [8.3]], 6)
Example #2
0
    def test_set_loc(self):
        for ct in self.ctypeS:
            print(ct)

            l = Landmark(ctype=ct)
            l.loc = [1,1,1]
            numpy.testing.assert_equal(l.loc, [1, 1, 1])

            l.loc = [9.12,
                     4.1,
                     8.3]
            numpy.testing.assert_almost_equal(l.loc, [9.12,
                                                      4.1,
                                                      8.3], 6)
Example #3
0
    def test_clone(self):
        # Should be able to clone an instance, modify either and NOT see the
        # change in the other
        l1 = Landmark([1, 2, 3], 4)
        l2 = l1.clone()

        # They should be the same at this point
        numpy.testing.assert_equal(l1.loc, [[1],
                                            [2],
                                            [3]])
        nose.tools.assert_equal(l1.scale, 4)
        numpy.testing.assert_equal(l2.loc, l1.loc)
        nose.tools.assert_equal(l1.scale, l2.scale)

        l1.loc = [[5],
                  [6],
                  [7]]
        numpy.testing.assert_equal(l1.loc, [[5],
                                            [6],
                                            [7]])
        numpy.testing.assert_equal(l2.loc, [[1],
                                            [2],
                                            [3]])

        l2.scale = 8
        nose.tools.assert_equal(l1.scale, 4)
        nose.tools.assert_equal(l2.scale, 8)