Skip to content

Commit

Permalink
test oblong shape for ellipse
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Dec 30, 2022
1 parent 5e6b597 commit 1620ebd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/test_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _cube(ngroups, readnoise=10):
return _cube


@pytest.mark.xfail(not ELLIPSE_PACKAGE_INSTALLED, reason="`opencv-python` not installed")
@pytest.mark.xfail(not ELLIPSE_PACKAGE_INSTALLED, reason="image package not installed")
def test_find_simple_circle():
plane = np.zeros(shape=(5, 5), dtype=np.uint8)
plane[2, 2] = DQFLAGS['JUMP_DET']
Expand All @@ -45,23 +45,25 @@ def test_find_simple_circle():
plane[2, 3] = DQFLAGS['JUMP_DET']
plane[2, 1] = DQFLAGS['JUMP_DET']
circle = find_circles(plane, DQFLAGS['JUMP_DET'], 1)
assert circle[0][0] == pytest.approx((2, 2))
assert circle[0][1] == pytest.approx(1.0, 1e-3)


@pytest.mark.xfail(not ELLIPSE_PACKAGE_INSTALLED, reason="`opencv-python` not installed")
@pytest.mark.xfail(not ELLIPSE_PACKAGE_INSTALLED, reason="image package not installed")
def test_find_simple_ellipse():
plane = np.zeros(shape=(5, 5), dtype=np.uint8)
plane = np.zeros(shape=(5, 7), dtype=np.uint8)
plane[2, 1] = DQFLAGS['JUMP_DET']
plane[2, 2] = DQFLAGS['JUMP_DET']
plane[3, 2] = DQFLAGS['JUMP_DET']
plane[1, 2] = DQFLAGS['JUMP_DET']
plane[2, 3] = DQFLAGS['JUMP_DET']
plane[2, 1] = DQFLAGS['JUMP_DET']
plane[1, 3] = DQFLAGS['JUMP_DET']
plane[2, 4] = DQFLAGS['JUMP_DET']
plane[2, 3] = DQFLAGS['JUMP_DET']
plane[3, 3] = DQFLAGS['JUMP_DET']
plane[1, 4] = DQFLAGS['JUMP_DET']
plane[2, 4] = DQFLAGS['JUMP_DET']
plane[2, 5] = DQFLAGS['JUMP_DET']
ellipse = find_ellipses(plane, DQFLAGS['JUMP_DET'], 1)
assert ellipse[0][2] == pytest.approx(45.0, 1e-3) # 90 degree rotation
assert ellipse[0][0] == pytest.approx((2.5, 2.0)) # center
assert ellipse[0][2] == pytest.approx(63.435, 1e-3) # anti-clockwise rotation
assert ellipse[0][0] == pytest.approx((3, 2)) # center


@pytest.mark.skip(reason="only for local testing")
Expand Down

0 comments on commit 1620ebd

Please sign in to comment.