def test_dist_stitcher(self): src = self.setup_positions([[0, 1, 2, 3, 4]]) dst = self.setup_positions([[0, 1, 2, 5, 6]]) self.transform(src, s_i=1) stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst) == 1, 'Wrong number of subclusters.') rms = get_rms(self.test_cluster, dst) self.assertTrue(rms < 0.001, 'Stitching was not good enough.')
def test_dist_stitcher(self): src = self.setup_positions([[0, 1, 2, 3, 4]]) dst = self.setup_positions([[0, 1, 2, 5, 6]]) self.transform(src, s_i=1) stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst)==1, 'Wrong number of subclusters.') rms = get_rms(self.test_cluster, dst) self.assertTrue(rms<0.001, 'Stitching was not good enough.')
def test_dist_stitcher2(self): """ Test dist stitch with only 2 common nodes - not enough. """ src = self.setup_positions([[0, 1, 3, 4]]) dst = self.setup_positions([[0, 1, 2, 5, 6]]) self.transform(src, s_i=1) #transform src positions stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst) == 2, 'Wrong number of subclusters.') rms = get_rms(self.test_cluster, dst) self.assertFalse(rms < 0.001, 'Stitching was too good.') # with align rms should be ok rms_align = get_rms(self.test_cluster, dst, align=True) self.assertTrue(rms_align < 0.001, 'Stitching was not good enough.')
def test_dist_stitcher2(self): """ Test dist stitch with only 2 common nodes - not enough. """ src = self.setup_positions([[0, 1, 3, 4]]) dst = self.setup_positions([[0, 1, 2, 5, 6]]) self.transform(src, s_i=1) #transform src positions stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst)==2, 'Wrong number of subclusters.') rms = get_rms(self.test_cluster, dst) self.assertFalse(rms<0.001, 'Stitching was too good.') # with align rms should be ok rms_align = get_rms(self.test_cluster, dst, align=True) self.assertTrue(rms_align<0.001, 'Stitching was not good enough.')
def align_clusters(dst, src, scale): """ Scale, rotate, translate srcLoc w.r.t. dst. """ assert (isinstance(src, Positions)) assert (isinstance(dst, Positions)) if scale: stitcher = AoAStitcher(reflectable=True) else: stitcher = DistStitcher() stitcher.align(dst, src)
def test_dist_intrastitch(self): """ Test dist intrastitch Clusters are setup so that first stitch is src[0] with dst[1] and then dst[0] and dst[1] can be intrastitched. """ src = self.setup_positions([[1, 2, 4, 5, 6]]) dst = self.setup_positions([[0, 2, 3, 4], [0, 1, 2, 6]]) self.transform(src, s_i=1) #transform src positions self.transform(dst, s_i=1) #transform src positions stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst) == 1, 'Wrong number of subclusters.') # without align new subcluster should be wrongly (not) rotated rms = get_rms(self.test_cluster, dst) self.assertFalse(rms < 0.001, 'Stitching was too good.') # with align rms should be ok rms_align = get_rms(self.test_cluster, dst, align=True) self.assertTrue(rms_align < 0.001, 'Stitching was not good enough.')
def test_dist_intrastitch(self): """ Test dist intrastitch Clusters are setup so that first stitch is src[0] with dst[1] and then dst[0] and dst[1] can be intrastitched. """ src = self.setup_positions([[1, 2, 4, 5, 6]]) dst = self.setup_positions([[0, 2, 3, 4], [0, 1, 2, 6]]) self.transform(src, s_i=1) #transform src positions self.transform(dst, s_i=1) #transform src positions stitcher = DistStitcher() stitcher.stitch(dst, src) self.assertTrue(len(dst)==1, 'Wrong number of subclusters.') # without align new subcluster should be wrongly (not) rotated rms = get_rms(self.test_cluster, dst) self.assertFalse(rms<0.001, 'Stitching was too good.') # with align rms should be ok rms_align = get_rms(self.test_cluster, dst, align=True) self.assertTrue(rms_align<0.001, 'Stitching was not good enough.')