Hello,
I was wondering if there was an elegant way to find all of the upstream and downstream sections and segments from a node. For example, say I wanted to find the average voltage of all sections upstream from an current injection point. To do this I would need to know the voltage at all the nodes upstream from the cite of my injection. Is there a way to find out what the upsteam sections and segments are, or do I need to make a list by hand?
Thanks!!
Finding upstream and downstream sections and segments
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Finding upstream and downstream sections and segments
Code: Select all
objref sl
sl = new SectionList()
foo sl.children() // appends all children of foo to sl
Re: Finding upstream and downstream sections and segments
I knew there would be a fabulous way to do it!
Is there an equally fabulous way to make a list of all the distal most sections of an arbor? I couldn't quite figure it out using the recommended statements.
Thanks!
Is there an equally fabulous way to make a list of all the distal most sections of an arbor? I couldn't quite figure it out using the recommended statements.
Thanks!
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Finding upstream and downstream sections and segments
First make a SectionList that contains all children of the arbor's root section. Assuming the root section's name is fooThen iterate over all the sections in that SectionList to identify those that have no children
Code: Select all
objref tree
tree = new SectionList()
foo tree.wholetree()
Code: Select all
objref terminals, thisone
terminals = new SectionList()
forsec tree {
thisone = new SectionRef()
if (thisone.nchild == 0) terminals.append()
}
objref thisone // destroy link between thisone and the last referenced section
// for the sake of safety