Hi,
Very basic question... still learning how to talk to NEURON...
Wondering how to get lengths and areas of segments that are subsections of a section in the oc> prompt.
So for example, I wish to know the area of segments 05 of a given section that has 100 segments. How would I ask the oc> prompt for this information?
Something like:
finitialize()
_sum = 0
forsec SectionName for ?? _sum+= area(?)
_sum
Similarly for L, which I understand works a little differently from area(x)...
Thanks!
How to use area(x) and L

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: How to use area(x) and L
It would be useful to read chapters 5 and 6 of The NEURON Book. If you don't have the book, try
"The NEURON simulation environment" (not the "overview") and "NEURON: a tool for neuroscientists,"
both of which are available from http://www.neuron.yale.edu/neuron/docs. Let me also suggest the Programmer's Reference entry on nseg.
Now for your question.
secname for (x,0) print x, area(x)
where secname is the name of the section
will tell you everything about segment areas.
If you want to know the total area of the first n segmentsThis has no bulletproofing against arguments valued < 1.
All segments in a section have equal length. The total length of the first i segments of a section is i*L/nseg, where i lies in the range [1..nseg].
Note that NEURON computes the values of range variables at internal nodes, where each node is located at the midpoint of its segment. Membrane potential v is special in the sense that its value at the 0 or 1 end of a section depends not only on the potential at the adjacent internal node of that section, but also on the boundary condition at that point i.e. whether any other sections or signal sources (e.g. SEClamp, IClamp, synaptic mechanism) are attached to that point.
"The NEURON simulation environment" (not the "overview") and "NEURON: a tool for neuroscientists,"
both of which are available from http://www.neuron.yale.edu/neuron/docs. Let me also suggest the Programmer's Reference entry on nseg.
An aside: after reading about nseg you'll see why you might want to use an odd value for nseg.charles1 wrote:I wish to know the area of segments 05 of a given section that has 100 segments.
Now for your question.
secname for (x,0) print x, area(x)
where secname is the name of the section
will tell you everything about segment areas.
If you want to know the total area of the first n segments
Code: Select all
func arean() { localobj tobj
tobj = new Vector()
for (x,0) tobj.append(area(x))
return tobj.sum(0,$11)
}
foo arean(4) // print total area of the first 4 segments of the section called foo
All segments in a section have equal length. The total length of the first i segments of a section is i*L/nseg, where i lies in the range [1..nseg].
Note that NEURON computes the values of range variables at internal nodes, where each node is located at the midpoint of its segment. Membrane potential v is special in the sense that its value at the 0 or 1 end of a section depends not only on the potential at the adjacent internal node of that section, but also on the boundary condition at that point i.e. whether any other sections or signal sources (e.g. SEClamp, IClamp, synaptic mechanism) are attached to that point.
Re: How to use area(x) and L
I created a bunch of segments that comprise a section with Neuroleucida. I import my morphology into NEURON and implement an nseg strategy based on d_lambda... It is the area of a subset of these bunch of segments that I still wish to obtain.
I have understood how to use L: if I want the total length of any given subset of segments of a section, I write in the oc prompt the following:
print secname[0].L + secname[1].L ++
I still do not understand how to do the same with area(x), even with what you wrote:
I do not understand what area is returned in "secname for (x,0) print x, area(x)." For example, the only parameter I can change is the "0" in (x,0), yet the area printed is always the same... secname for (x,0) print x, area(x) = secname for (x,1) print x, area(x)... any other variation does not work...
Thanks!
I have understood how to use L: if I want the total length of any given subset of segments of a section, I write in the oc prompt the following:
print secname[0].L + secname[1].L ++
I still do not understand how to do the same with area(x), even with what you wrote:
I do not understand how to use this to obtain the area of a subset of segments of my section.ted wrote:secname for (x,0) print x, area(x)
where secname is the name of the section
will tell you everything about segment areas.
I do not understand what area is returned in "secname for (x,0) print x, area(x)." For example, the only parameter I can change is the "0" in (x,0), yet the area printed is always the same... secname for (x,0) print x, area(x) = secname for (x,1) print x, area(x)... any other variation does not work...
Thanks!

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: How to use area(x) and L
Time to make a very simple model, specified in hoc, and play with the code until you understand what's going on. You might start withUse this simple model to figure out what total area is, what segment area should be for different values of nseg, etc.
Code: Select all
load_file("nrngui.hoc")
create soma
access soma
soma {
L = 10
diam = 1
}