arc3d distance

Anything that doesn't fit elsewhere.
Post Reply
ramcdougal
Posts: 153
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Medicine

arc3d distance

Post by ramcdougal » Fri Nov 04, 2011 1:33 pm

According to The NEURON Book page 109,
arc3d(i) is the anatomical distance of the ith 3-D point from the 0 end of the section.
I think the following code constructs two sections s1 and s2, makes s2 a child of s1 whose 1 end is connected to s1's 1 end, and then prints their x, y, z, and arc length values for their 3d points.

Code: Select all

from neuron import h

s1 = h.Section()
s2 = h.Section()

s2.connect(s1, 1, 1)
h.define_shape()

for sname, s in zip(['s1', 's2'], [s1, s2]):
    s.push()
    print '%s:   (orientation = %d)' % (sname, h.section_orientation())
    for i in xrange(int(h.n3d())):
        print '    %5g %5g %5g %5g' % (h.x3d(i), h.y3d(i), h.z3d(i), h.arc3d(i))
    h.pop_section()
Since the 0 end of s2 is far from the common point, I'd expect the common point to have a large arc3d() value. Instead s2's arc3d() value at the connection point is 0:

Code: Select all

s1:   (orientation = 0)
        0     0     0     0
       50     0     0    50
      100     0     0   100
s2:   (orientation = 1)
      100     0     0     0
      150     0     0    50
      200     0     0   100
What am I misunderstanding? Thanks.

ted
Site Admin
Posts: 5567
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: arc3d distance

Post by ted » Sat Nov 05, 2011 12:31 pm

Good question. This is an illustration of how perverse actions often have consequences that appear perverse. Indeed, it is a case of a double perversity.

The first perversity is attaching a child's 1 end to the 1 end of its parent. Don't do that unless you want to generate confusion (in yourself and others; the computer is never confused). It is the root node of the root section that dictates the direction of increasing arc distance: arc distance increases with increasing distance from the root node of the root section. That's why arc distance in s2 increases from its 1 end to its 0 end. And it's also why define_shape() created pt3d data points such that x3d increases from the 1 end to the 0 end of s2.

The second perversity is trying to make sense of a confusing outcome by taking a statement out of context. The statement quoted from the NEURON Book was written in the context of a model whose topology was set up in such a way as to avoid generating confusion, and it is true in the context of such a model.

For a statement that is true under all circumstances, I quote the documentation of arc3d in the Programmer's Reference:
SYNTAX
arc3d(i)
DESCRIPTION
This is the arc length position of the ith point in the 3d list. arc3d(n3d()-1) == L
"Well, doesn't that mean that the statement in the NEURON Book is misleading?"
No. The particular model that is considered on that page has only one section, and in the context of that model, the statement in the book is simple, clear, and correct. It would be an intrusive diversion, more likely to baffle than inform, to insert a discussion full of caveats that pertain to models with multiple sections.

So--

To avoid confusion about arc length and related issues, follow these simple rules:
1. Always connect the 0 end of a child section to its parent.
2. NEVER connect the 1 end of a child section to a parent.

Post Reply