示例#1
0
    def test_basic(self):
        img = np.random.randint(255, size=(200, 200))

        pulses = lulu.decompose(img)
        img_ = lulu.reconstruct(pulses, img.shape)

        # Write assert this way so that we can see how many
        # pixels mismatch as a percent of the total nr of pixels
        assert_array_equal(img_, img)
        assert_equal(np.sum(img_ != img) / float(np.prod(img.shape)) * 100,
                     0, "Percentage mismatch =")
示例#2
0
    def test_basic(self):
        img = np.random.randint(255, size=(200, 200))

        pulses = lulu.decompose(img)
        img_ = lulu.reconstruct(pulses, img.shape)

        # Write assert this way so that we can see how many
        # pixels mismatch as a percent of the total nr of pixels
        assert_array_equal(img_, img)
        assert_equal(
            np.sum(img_ != img) / float(np.prod(img.shape)) * 100, 0,
            "Percentage mismatch =")
示例#3
0
def test_basic():
    x = np.zeros((100, 100), dtype=int)
    x[50, 50] = 1
    F, A = sf.dpt.features(dpt.decompose(x), x.shape)

    assert_equal(np.unravel_index(np.argmax(F), F.shape), [50, 50])
示例#4
0
def test_basic():
    x = np.zeros((100, 100), dtype=int)
    x[50, 50] = 1
    F, A = sf.dpt.features(dpt.decompose(x), x.shape)

    assert_equal(np.unravel_index(np.argmax(F), F.shape), [50, 50])