Can't load from neuron.rxd.morphology

Post Reply
Elishai
Posts: 1
Joined: Wed Apr 18, 2018 6:44 am

Can't load from neuron.rxd.morphology

Post by Elishai »

Hi,

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?

Thanks
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

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

Post 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
>>> dend.trueparentseg()
soma(1)
>>> dend.trueparentseg().sec
soma
>>> dend.trueparentseg().x
1.0
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: https://github.com/neuronsimulator/nrn/ ... phology.py
Post Reply