Page 1 of 1
question about templates
Posted: Fri Feb 05, 2010 7:41 pm
by ppt
Hi,
I built a complicated morphology. I would like to be able to duplicate many clones of that morphology and then wire them together using the usual "connect" statement. I figured the way to do it is to embed the hoc code in a template and then generate as many instances of the morphology as I need. My question is: what is the correct syntax or method for then directly connecting them in this way? I naively (not having used templates before) tried something like "connect Cell[1].dend(0), Cell[0].dend(1)" with dend made public and all, but that doesn't do it.
Thanks
Re: question about templates
Posted: Fri Feb 05, 2010 8:47 pm
by ted
Can't tell where your code went wrong without seeing it, but I'll email you a little program I wrote a while back that may help you find your error and maybe give you some new ideas.
Re: question about templates
Posted: Fri Feb 05, 2010 8:53 pm
by ted
Better than email: pick up this file
http://www.neuron.yale.edu/ftp/ted/neuron/btree6s.hoc
and use NEURON to execute it. It could probably be more elegant, but it should at least get you going.
Re: question about templates
Posted: Sat Feb 06, 2010 3:00 am
by ppt
Ted, it works when I follow the example in your code and connect the "template tree" to a section created outside of the template but not when connecting two template trees.
In other words, from your code:
Code: Select all
connect stree[0].dend[0](0), core[0](0)
is fine, but:
Code: Select all
connect stree[0].dend[0](0), stree[1].dend[0](0)
just gives an error.
Is it necessary to connect two template trees through an intermediate section?
Re: question about templates
Posted: Sat Feb 06, 2010 1:28 pm
by ted
Tell me if the error message you saw is something like this:
Code: Select all
[...](...) syntax only allowed for array range variables: dend
in bah.hoc near line 176
connect stree[1].dend[0](0), stree[0].dend[0](1)
^
This is somewhat puzzling because the error is localized to the second occurrence of [...](...) on the line, and I would have expected hoc to gag on the first occurrence. But that's the way it works.
So the error message implies that the parent section must be specified in a different way. The documentation of the connect statement presents these two forms:
connect childsection(0or1), x
connect childsection(0or1), parent(x)
Try the first form, and it works--e.g.
Code: Select all
stree[0].dend[0] connect stree[1].dend[0](0), 1
treats stree[0].dend[0] as the parent section, stree[1].dend[0] as the child, and attaches the 0 end of the child to the 1 end of the parent.
Re: question about templates
Posted: Mon Feb 08, 2010 6:47 pm
by ppt
I got the same error message as you, but using the first form of the connect statement, as you suggest, does the trick.
Many thanks for the help! I suspect I would have beaten my head against the keyboard for a long time before thinking the connect statement would work in one form but not the other.