Page 1 of 1

Can't load from neuron.rxd.morphology

Posted: Sun Jun 30, 2019 6:46 am
by Elishai

Just installed neuron (the latest version: 7.7) on a new Mac.
Got neuron to work. I can import neuron normally and execute simulations.

However, when trying to import the parent function with:
from neuron.rxd.morphology import parent, parent_loc

I get the following error:
ModuleNotFoundError: No module named 'neuron.rxd.morphology'

I can import neutron.rxd successfully but I can't load the morphology class.
I used this import like a million time before without any issues..

Any ideas?


Re: Can't load from neuron.rxd.morphology

Posted: Mon Jul 01, 2019 11:12 am
by ramcdougal
Unfortunately, this isn't in 7.7; we considered it an internal class and didn't realize people were using it otherwise.

The general workaround is to use the corresponding section method trueparentseg (there's also a parentseg); e.g.

Code: Select all

>>> from neuron import h
>>> soma = h.Section(name='soma')
>>> dend = h.Section(name='dend')
>>> dend.connect(soma)
>>> dend.trueparentseg()
>>> dend.trueparentseg().sec
>>> dend.trueparentseg().x
trueparentseg is almost equivalent to the behavior of neuron.rxd.morphology.parent. The one difference is that if something is attached to the 0 end of the root section, then trueparentseg will return None, but parentseg will return the 0 end of the root section.

The main difference between trueparentseg and parentseg is that trueparentseg always returns a node that is strictly closer to the root node (if such a node exists, else None) while parentseg returns the node the section was connected to, which may be the same distance from the root node if things were connected to the 0 end.

That said, the functions in question are short; you could copy and paste them from the NEURON 7.6 branch of the repo: ...