Code: Select all
child.connect(parent(0.7), 0.0)
h.parent_connection(child)
# returns 0.0
child.parentseg().x
# returns 0.7
The link to the reference:
https://www.neuron.yale.edu/neuron/stat ... connection
Code: Select all
child.connect(parent(0.7), 0.0)
h.parent_connection(child)
# returns 0.0
child.parentseg().x
# returns 0.7
Code: Select all
from neuron import h
parent = h.Section(name='parent')
child0 = h.Section(name='child0')
child1 = h.Section(name='child1')
parent.nseg = 5
child0.connect(parent(0.1), 0.0)
child1.connect(parent(0.9), 1.0)
h.topology()
Code: Select all
|-----| parent(0-1)
`| child1(1-0)
`| child0(0-1)
Code: Select all
>>> h.parent_connection(sec = child0)
0.1
>>> h.parent_connection(sec = child1)
0.9
And he's right.we should explicitly advise against using h.parent_connection in Python, as sec.parentseg() and sec.trueparentseg() are more useful.
Fortunately,things that work on a Section in HOC generally need to have sec= specified… You cannot in general drop the sec= and pass it as a positional argument, although a number of functions have been modified to allow that.
with an extremely small set of exceptions having to do with thread identification (e.g. Vector.record, NetCon), everything that works on a Section has an equivalent Section method in Python, so besides the above there should be no need to ever use the functions that need a sec=