Example #1
0
def test_distort():
    rng = np.random.RandomState(4)
    new_pts = distort([[0, 0], [2, 1], [1, 3]], '2', rng)
    assert np.allclose(new_pts, [(1, -1), (2, -1), (1, 3)])

    new_pts = distort([[0, 0], [2, 1], [1, 3]], '7.7', rng)
    assert np.allclose(new_pts, [(5, -4), (2, 2), (-5, -5)])
Example #2
0
def test_distort():
    rng = np.random.RandomState(4)
    new_pts = distort([[0, 0], [2, 1], [1, 3]], '2', rng)
    assert np.allclose(new_pts, [(1, -1), (2, -1), (1, 3)])

    new_pts = distort([[0, 0], [2, 1], [1, 3]], '7.7', rng)
    assert np.allclose(new_pts, [(5, -4), (2, 2), (-5, -5)])
Example #3
0
def test_boundary_conditions():
    rng = np.random.RandomState(4)
    acc = None
    for i in range(1000):
        coords = prototype_coords(rng)
        dcoords = distort(coords, '7.7', rng)
        assert dcoords.min() >= 0
        assert dcoords.max() < 50
        if acc is None:
            acc = render_coords(dcoords)
        else:
            acc += render_coords(dcoords)

    if 0:
        import matplotlib.pyplot as plt
        plt.imshow(acc, cmap='gray', interpolation='nearest')
        plt.show()
Example #4
0
def test_boundary_conditions():
    rng = np.random.RandomState(4)
    acc = None
    for i in range(1000):
        coords = prototype_coords(rng)
        dcoords = distort(coords, '7.7', rng)
        assert dcoords.min() >= 0
        assert dcoords.max() < 50
        if acc is None:
            acc = render_coords(dcoords)
        else:
            acc += render_coords(dcoords)

    if 0:
        import matplotlib.pyplot as plt
        plt.imshow(acc, cmap='gray', interpolation='nearest')
        plt.show()