bdf2142281710cba0154bc5d63b3e8c55486509d,test/augmentables/test_polys.py,Test_ConcavePolygonRecoverer,test__jitter_duplicate_points,#Test_ConcavePolygonRecoverer#,2174
Before Change
def test__jitter_duplicate_points(self):
cpr = _ConcavePolygonRecoverer(threshold_duplicate_points=1e-4)
points = [(0, 0), (1, 0), (1, 1), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, np.random.RandomState(0))
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (1, 0), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, np.random.RandomState(0))
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (0.01, 0), (0.01, 0.01), (0, 0.01)]
points_jittered = cpr._jitter_duplicate_points(points, np.random.RandomState(0))
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (1, 0), (1 + 1e-6, 0), (1, 1), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, np.random.RandomState(0))
assert np.allclose(
[point for i, point in enumerate(points_jittered) if i in [0, 1, 3, 4]],
[(0, 0), (1, 0), (1, 1), (0, 1)],
rtol=0,
atol=1e-5
)
assert np.linalg.norm(np.float32([1, 0]) - np.float32(points_jittered[2])) >= 1e-4
points = [(0, 0), (1, 0), (1, 1), (1 + 1e-6, 0), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, np.random.RandomState(0))
assert np.allclose(
[point for i, point in enumerate(points_jittered) if i in [0, 1, 2, 4]],
[(0, 0), (1, 0), (1, 1), (0, 1)],
After Change
return np.linalg.norm(np.float32(a) - np.float32(b))
cpr = _ConcavePolygonRecoverer(threshold_duplicate_points=1e-4)
rng = iarandom.RNG(0)
points = [(0, 0), (1, 0), (1, 1), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (1, 0), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (0.01, 0), (0.01, 0.01), (0, 0.01)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(points, points_jittered, rtol=0, atol=1e-4)
points = [(0, 0), (1, 0), (1 + 1e-6, 0), (1, 1), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(
[point
for i, point
in enumerate(points_jittered)
if i in [0, 1, 3, 4]],
[(0, 0), (1, 0), (1, 1), (0, 1)],
rtol=0,
atol=1e-5
)
assert _norm([1, 0], points_jittered[2]) >= 1e-4
points = [(0, 0), (1, 0), (1, 1), (1 + 1e-6, 0), (0, 1)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(
[point
for i, point
in enumerate(points_jittered)
if i in [0, 1, 2, 4]],
[(0, 0), (1, 0), (1, 1), (0, 1)],
rtol=0,
atol=1e-5
)
assert _norm([1, 0], points_jittered[3]) >= 1e-4
points = [(0, 0), (1, 0), (1, 1), (0, 1), (1 + 1e-6, 0)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(
[point
for i, point
in enumerate(points_jittered)
if i in [0, 1, 2, 3]],
[(0, 0), (1, 0), (1, 1), (0, 1)],
rtol=0,
atol=1e-5
)
assert _norm([1, 0], points_jittered[4]) >= 1e-4
points = [(0, 0), (1, 0), (1 + 1e-6, 0), (1, 1), (1 + 1e-6, 0), (0, 1),
(1 + 1e-6, 0), (1 + 1e-6, 0 + 1e-6), (1 + 1e-6, 0 + 2e-6)]
points_jittered = cpr._jitter_duplicate_points(points, rng.copy())
assert np.allclose(
[point
for i, point
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 19
Instances
Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__jitter_duplicate_points
Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__jitter_duplicate_points
Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__fit_best_valid_polygon
Project Name: aleju/imgaug
Commit Name: bdf2142281710cba0154bc5d63b3e8c55486509d
Time: 2019-08-30
Author: kontakt@ajung.name
File Name: test/augmentables/test_polys.py
Class Name: Test_ConcavePolygonRecoverer
Method Name: test__fix_polygon_is_line