projects
/
hooke.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d1e91f
)
Ensure unique segment names in the JPK driver.
author
W. Trevor King
<wking@drexel.edu>
Wed, 8 Sep 2010 20:21:39 +0000
(16:21 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Wed, 8 Sep 2010 20:21:39 +0000
(16:21 -0400)
hooke/driver/jpk.py
patch
|
blob
|
history
diff --git
a/hooke/driver/jpk.py
b/hooke/driver/jpk.py
index 286766cb58c62a16153ef10e7f201db8462bcf5e..71af831b0be25e1872c807008344e7d210e18e19 100644
(file)
--- a/
hooke/driver/jpk.py
+++ b/
hooke/driver/jpk.py
@@
-90,7
+90,15
@@
class JPKDriver (Driver):
if key in curve_info:
segment.info['spring constant (N/m)'] = \
curve_info['spring constant (N/m)']
-
+ names = [segment.info['name'] for segment in segments]
+ for name in set(names): # ensure unique names
+ count = names.count(name)
+ if count > 1:
+ i = 0
+ for j,n in enumerate(names):
+ if n == name:
+ segments[j].info['name'] += '-%d' % i
+ i += 1
return (segments, curve_info)
def _zip_info(self, zipfile):