Commit 8d210e3b authored by cmaffeo2's avatar cmaffeo2
Browse files

Fixed a bug in the function that locates where a bead is within the contour of a non-parent segment

parent 1e2394ef
......@@ -279,23 +279,25 @@ class SegmentParticle(PointParticle):
assert( sign in (1,-1) )
if distance < cutoff: # TODO: check if this does anything
cutoff = distance
return [[distance, contour_in_seg+sign*seg.nt_pos_to_contour(distance)]]
return [[distance, contour_in_seg+sign*seg.nt_pos_to_contour(distance)]], [(seg, contour_in_seg, distance)]
if distance > cutoff:
return None
return None,None
ret_list = []
hist_list = []
## Find intrahelical locations in seg that we might pass through
for c,A,B in seg.get_connections_and_locations("intrahelical"):
if B.container in visited_segs: continue
dx = seg.contour_to_nt_pos( np.abs(A.address-contour_in_seg),
round_nt=False)
results = descend_search_tree( B.container, B.address,
dx = seg.contour_to_nt_pos( A.address, round_nt=False ) - seg.contour_to_nt_pos( contour_in_seg, round_nt=False)
dx = np.abs(dx)
results,history = descend_search_tree( B.container, B.address,
distance+dx, visited_segs + [seg] )
if results is not None:
ret_list.extend( results )
return ret_list
hist_list.extend( history )
return ret_list,hist_list
results = descend_search_tree(self.parent, self.contour_position)
results,history = descend_search_tree(self.parent, self.contour_position)
if results is None or len(results) == 0:
raise Exception("Could not find location in segment") # TODO better error
return sorted(results,key=lambda x:x[0])[0][1]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment