Commit 5d97a736 authored by cmaffeo2's avatar cmaffeo2
Browse files

Added code to allow segment model to be extended or updated

parent 4412e203
...@@ -1280,14 +1280,32 @@ class SegmentModel(ArbdModel): ...@@ -1280,14 +1280,32 @@ class SegmentModel(ArbdModel):
k = opt.leastsq( fitFun, x0=np.exp(-sep/Lp) ) k = opt.leastsq( fitFun, x0=np.exp(-sep/Lp) )
return k[0][0] * 2*kT*0.00030461742 return k[0][0] * 2*kT*0.00030461742
def extend(self, other, copy=True):
assert( isinstance(other, SegmentModel) )
if copy:
for s in other.segments:
self.segments.append(deepcopy(s))
else:
for s in other.segments:
self.segments.append(s)
self._clear_beads()
def update(self, segment , copy=False):
assert( isinstance(other, SegmentModel) )
if copy:
segment = deepcopy(segment)
self.segments.append(segment)
self._clear_beads()
""" Mapping between different resolution models """ """ Mapping between different resolution models """
def _clear_beads(self): def _clear_beads(self):
for s in self.segments: for s in self.segments:
s.clear_all() s.clear_all()
self.clear_all(keep_children=True) self.clear_all(keep_children=True)
## Check that it worked
assert( len([b for b in self]) == 0 ) assert( len([b for b in self]) == 0 )
locParticles = [] locParticles = []
# for c,A,B in self.get_connections():
for s in self.segments: for s in self.segments:
for c,A,B in s.get_connections_and_locations(): for c,A,B in s.get_connections_and_locations():
for l in (A,B): for l in (A,B):
......
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