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
question about templates
-
- Site Admin
- Posts: 6305
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: question about templates
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.
-
- Site Admin
- Posts: 6305
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: question about templates
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.
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
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:
is fine, but:
just gives an error.
Is it necessary to connect two template trees through an intermediate section?
In other words, from your code:
Code: Select all
connect stree[0].dend[0](0), core[0](0)
Code: Select all
connect stree[0].dend[0](0), stree[1].dend[0](0)
Is it necessary to connect two template trees through an intermediate section?
-
- Site Admin
- Posts: 6305
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: question about templates
Tell me if the error message you saw is something like this:
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.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.
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)
^
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
Re: question about templates
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.
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.