-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwarn.py
executable file
·50 lines (40 loc) · 1.09 KB
/
warn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import re
import sys
def shrink_warning(who, dist, amount):
not_applicable=[]
status=False
for dend in who:
if dist[dend] < int(amount):
not_applicable.append(dend)
status=True
return status, not_applicable
def check_terminal(who, all_terminal):
not_terminal=[]
for dend in who:
if dend not in all_terminal:
not_terminal.append(dend)
if len(not_terminal)>0:
print '\nYou have to remove the following non-terminal dendrites from the modification list:\n'
for dend in not_terminal:
print '> ' + str(dend)
print '\nProgram stopped\n'
exit(1)
def check_indices(newfile):
ilist=[]
for line in newfile:
if re.search(r'#', line):
pass
else:
index=re.search(r'(\d+) (\d+) (.*?) (.*?) (.*?) (.*?) (-?\d+)', line)
i=int(index.group(1))
ilist.append([i, line])
status=True
for i in range(len(ilist)-1):
if ilist[i+1][0]-ilist[i][0]!=1:
print "Error! Non-continuity of segment indices found at:", ilist[i][0], ilist[i][1]
status=False
if status==True:
"\nSegment indices are continuous!"
else:
"\nError! Segment indices are not continuous"
#sys.exit(0)