## How to use area(x) and L

The basics of how to develop, test, and use models.
charles1
Posts: 24
Joined: Thu Apr 26, 2012 8:41 am

### How to use area(x) and L

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 0-5 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!
ted
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.
charles1 wrote:I wish to know the area of segments 0-5 of a given section that has 100 segments.
An aside: after reading about nseg you'll see why you might want to use an odd value for nseg.

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))
}
foo arean(4) // print total area of the first 4 segments of the section called foo``````
This 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.
charles1
Posts: 24
Joined: Thu Apr 26, 2012 8:41 am

### 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.L + secname.L ++

I still do not understand how to do the same with area(x), even with what you wrote:
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 how to use this to obtain the area of a subset of segments of my section.

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!
ted
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 with

Code: Select all

``````load_file("nrngui.hoc")
create soma
access soma
soma {
L = 10
diam = 1
}``````
Use this simple model to figure out what total area is, what segment area should be for different values of nseg, etc.