Skip to content

Commit

Permalink
add test for circle_fitting
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsushiSakai committed May 12, 2018
1 parent 17b87c0 commit 3c4d1c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Mapping/circle_fitting/circle_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import random
import numpy as np

show_animation = True


def circle_fitting(x, y):
"""
Expand Down Expand Up @@ -120,15 +122,17 @@ def main():
ex, ey, er, error = circle_fitting(x, y)
print("Error:", error)

plt.cla()
plt.axis("equal")
plt.plot(0.0, 0.0, "*r")
plot_circle(cx, cy, cr)
plt.plot(x, y, "xr")
plot_circle(ex, ey, er, "-r")
plt.pause(dt)
if show_animation:
plt.cla()
plt.axis("equal")
plt.plot(0.0, 0.0, "*r")
plot_circle(cx, cy, cr)
plt.plot(x, y, "xr")
plot_circle(ex, ey, er, "-r")
plt.pause(dt)

print("Done")


if __name__ == '__main__':
# main1()
main()
12 changes: 12 additions & 0 deletions tests/test_circle_fitting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from unittest import TestCase

from Mapping.circle_fitting import circle_fitting as m

print(__file__)


class Test(TestCase):

def test1(self):
m.show_animation = False
m.main()

0 comments on commit 3c4d1c4

Please sign in to comment.