Page 1 of 1

area() function -- stylized method -- 3d-method

Posted: Mon Aug 27, 2018 5:58 pm
by ngreiner
Hello,

I am encountering a behaviour of the area() function which I don't understand, materialised by the code-example below.

The mentioned behaviour is that when I define the geometry of a section using the 3d-method, the formula `sec(0.5).area()` and `sec.L * sec.diam * h.PI` yield different results.
By contrast, when I define the section geometry using the stylized method, both formula above yield the same result.

Here is the code-example:

Code: Select all

from neuron import h

sec1 = h.Section()
h.pt3dadd(0.0, 0.0, 0.0, 60.0, sec=sec1)
h.pt3dadd(7.0, 0.0, 0.0, 10.0, sec=sec1)
print 'sec1 L: ', sec1.L
print 'sec1 diam: ', sec1.diam
print 'sec1 cust. area: ', sec1.L * sec1.diam * h.PI
print 'sec1 neuron area: ', sec1(0.5).area()
print ''

sec2 = h.Section()
sec2.L = 7.0
sec2.diam = 35.0
print 'sec2 L: ', sec2.L
print 'sec2 diam: ', sec2.diam
print 'sec2 cust. area: ', sec2.L * sec2.diam * h.PI
print 'sec2 neuron area: ', sec2(0.5).area()
which prints the following lines on the terminal
sec1 L: 7.0
sec1 diam: 35.0
sec1 cust. area: 769.690200129
sec1 neuron area: 2854.61711509

sec2 L: 7.0
sec2 diam: 35.0
sec2 cust. area: 769.690200129
sec2 neuron area: 769.690200129
Can anyone explain to me why this is so ?

Which one of the 2 formulae does NEURON use to compute the transmembrane currents ?

Thank you very much in advance for the help,

Nathan

Re: area() function -- stylized method -- 3d-method

Posted: Mon Aug 27, 2018 6:41 pm
by hines
When there are 3-d points the area of a segment is the sum of all frusta between adjacent 3-d points that intersect the segment. No curvature
effects are taken into account but effects of the sqrt(dradius^2 + darc^2) are taken into account
(notice that if there are two points at the same position
with different diameters, the area contribution is non-zero even though the length between the two points is 0)

Re: area() function -- stylized method -- 3d-method

Posted: Mon Aug 27, 2018 9:24 pm
by ramcdougal
There is some discussion about how segment areas and volumes are calculated at:

https://www.neuron.yale.edu/neuron/stat ... f-geometry

To say what hines said another way: in your first case, you're defining a tapered shape while the second case defines a cylinder.
For the tapered formula, see

http://mathworld.wolfram.com/ConicalFrustum.html

The other thing to keep in mind is that diam only gives you information about the diameter at one point within a segment (the midpoint) but the area and volume depend on potentially many changes in diameter, and you can only determine that by checking the 3d points.

(Thanks to hines for clarifying some of my confusion on this matter.)

Re: area() function -- stylized method -- 3d-method

Posted: Tue Aug 28, 2018 2:16 am
by ted
To return to this question
Which one of the 2 formulae does NEURON use to compute the transmembrane currents ?
NEURON uses the correct surface area, which is the value that area() returns.

Re: area() function -- stylized method -- 3d-method

Posted: Tue Aug 28, 2018 4:00 am
by ngreiner
Thank you for your replies.

I was puzzled by the value returned by sec(0.5).area() in the case of the 3d-method, but that was because my formula for calculating the side area of a frustum was incorrect. After using the appropriate formula (given at http://mathworld.wolfram.com/ConicalFrustum.html), the result I obtained matched the value returned by sec(0.5).area().

Nathan