Exemple #1
0
    def test_set_covar(self):
        f = Feature(ctype=ctypes.c_double)
        nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2],
                    [3, 4]]
        c = Covariance(2, ctypes.c_double, expected)
        f.covariance = c
        nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        nose.tools.assert_equal(f.covariance, c)

        # And for floats...
        f = Feature(ctype=ctypes.c_float)
        nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2],
                    [3, 4]]
        c = Covariance(2, ctypes.c_float, expected)
        f.covariance = c
        nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        nose.tools.assert_equal(f.covariance, c)
Exemple #2
0
    def test_set_covar(self):
        f = Feature(ctype='d')
        #nose.tools.assert_equal(f.covariance, Covariance.new_covar())

        expected = [[1, 2], [3, 4]]
        c = Covariance.from_matrix(2, 'd', expected)
        f.covariance = c
        #nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        #nose.tools.assert_equal(f.covariance, c)

        # And for floats...
        f = Feature(ctype='f')
        #nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2], [3, 4]]
        c = Covariance.from_matrix(2, 'f', expected)
        f.covariance = c
        #nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
Exemple #3
0
    def test_set_covar(self):
        f = Feature(ctype=ctypes.c_double)
        nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2], [3, 4]]
        c = Covariance(2, ctypes.c_double, expected)
        f.covariance = c
        nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        nose.tools.assert_equal(f.covariance, c)

        # And for floats...
        f = Feature(ctype=ctypes.c_float)
        nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2], [3, 4]]
        c = Covariance(2, ctypes.c_float, expected)
        f.covariance = c
        nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        nose.tools.assert_equal(f.covariance, c)
Exemple #4
0
    def test_set_covar(self):
        f = Feature(ctype='d')
        #nose.tools.assert_equal(f.covariance, Covariance.new_covar())

        expected = [[1, 2],
                    [3, 4]]
        c = Covariance.from_matrix(2, 'd', expected)
        f.covariance = c
        #nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected
        #nose.tools.assert_equal(f.covariance, c)

        # And for floats...
        f = Feature(ctype='f')
        #nose.tools.assert_equal(f.covariance, Covariance())

        expected = [[1, 2],
                    [3, 4]]
        c = Covariance.from_matrix(2, 'f', expected)
        f.covariance = c
        #nose.tools.assert_equal(f.covariance, c)
        # Should also work if we just give it the raw iterable
        f.covariance = expected