diff --git a/AmpScan/registration.py b/AmpScan/registration.py index b09c12a8fa04ab7deabe636634c2d241773f913a..3bc598b4eaf0d07eb7dc779bf2ffb2ca1249a4de 100644 --- a/AmpScan/registration.py +++ b/AmpScan/registration.py @@ -9,6 +9,11 @@ from scipy import spatial from AmpScan.core import AmpObject import matplotlib.pyplot as plt +# For the doc examples +import os +basefh = os.getcwd()+"\\tests\\stl_file.stl" +targfh = os.getcwd()+"\\tests\\stl_file_2.stl" + class registration(object): r""" Registration methods between two AmpObject meshes. This function morphs the baseline @@ -36,13 +41,10 @@ class registration(object): Examples -------- - >>> import os - >>> import AmpScan - >>> basefh = os.getcwd()+"\\tests\\stl_file.stl" - >>> targfh = os.getcwd()+"\\tests\\stl_file_2.stl" - >>> baseline = AmpScan.AmpObject(basefh) - >>> target = AmpScan.AmpObject(targfh) - >>> reg = AmpScan.registration(baseline, target, steps=10, neigh=10, smooth=1).reg + >>> from AmpScan.core import AmpObject + >>> baseline = AmpObject(basefh) + >>> target = AmpObject(targfh) + >>> reg = registration(baseline, target, steps=10, neigh=10, smooth=1).reg """ def __init__(self, baseline, target, method='point2plane', *args, **kwargs): diff --git a/tests/test_registration.py b/tests/test_registration.py new file mode 100644 index 0000000000000000000000000000000000000000..6a81ae21b5a23d656514850ead5203cdd8aa8ad1 --- /dev/null +++ b/tests/test_registration.py @@ -0,0 +1,21 @@ +""" +Testing suite for the core module +""" + +import unittest +import os +import numpy as np +from random import randrange + + +class TestCore(unittest.TestCase): + ACCURACY = 5 # The number of decimal places to value accuracy for - needed due to floating point inaccuracies + + def setUp(self): + """Runs before each unit test. + Sets up the AmpObject object using "sample_stl_sphere_BIN.stl". + """ + from AmpScan.core import AmpObject + stl_path = self.get_path("sample_stl_sphere_BIN.stl") + self.amp = AmpObject(stl_path) +