Defining 3D location information
Posted: Mon Apr 17, 2017 10:18 am
I am having trouble with a very basic issue: getting NEURON to tell me the 3D location of a cell. The "Conceptual Overview of Sections" documentation has the following snippet of code to print out the 3D coordinates of a cell:
I tried to implement something similar in Python:
The problem is that h.n3d() always returns 0 (actually 0.0, which is why I needed to force it to be an integer). On the one hand, I understand why this might be, since in the preceding code I did nothing to prescribe any 3D locations. But on the other hand, the code from "Conceptual Overview of Sections" does not prescribe any 3D locations before printing out such locations, leaving me to assume that NEURON assigns a default 3D location to a cell when it is created.
I am obviously missing something very basic here. Thanks in advance for the help.
Code: Select all
forall delete_section()
create a, b, c, d, e
connect b(0), a(1)
connect c(1), b(1)
connect d(0), b(1)
connect e(0), a(0)
forall nseg=20
forall L=100
forall diam(0:1) = 10:40
objref s
s = new Shape()
s.show(0)
a s.color(2)
topology()
finitialize()
forall {
print secname()
for i=0,n3d()-1 print i, x3d(i), y3d(i), z3d(i), diam3d(i)
}
Code: Select all
from neuron import h, gui
soma=h.Section(name='soma')
dend=h.Section(name='dend')
soma.diam = soma.L = 20
dend.diam = 2
dend.L=200
#define connectivity between sections
dend.connect(soma,0,0) #connect 0 end of dend to 0 end of soma
#none of these lines of code helps solve the problem
#h.topology()
#h.finitialize()
#h.define_shape()
for sec in h.allsec():
print "section=",sec.name()
for i in xrange(int(h.n3d())): print i, h.x3d(i), h.y3d(i), h.z3d(i), h.diam3d(i)
I am obviously missing something very basic here. Thanks in advance for the help.