Page 1 of 1

a non-recursive way to determine the branch order

Posted: Sun Dec 17, 2006 7:15 am
by stelescu
I suggest a non-recursive way to determine the brach order of a dendrite tree. This function will check if the parent section is a branch point or not. Finally the function return the order of the actual section. The code of this function is:

Code: Select all


func branchpoint() {local branch localobj sr 

branch=0 


sr = new SectionRef() 


while (sr.has_parent){ 
if (sr.nchild==2) { 
branch=branch+1 
} 
access sr.parent 
sr = new SectionRef() 
} 

return branch 
} 


Example: To determine the branch order of section [130] you can access the function in this way:

Code: Select all

access dend[130] 
print branchpoint()

Posted: Sun Dec 17, 2006 9:30 am
by ted
1. The func will return a nonsense value, not branch order.
2. Although it is true that the func does not recursively call itself, all you have done is to
push recursion inside the func--into the while statement.
3. The code is a example of "access abuse" (please read
Use only one "access" statement
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=608).
The way to avoid this is to use the
secname statement
syntax.