Page 1 of 1

Import MorphML file in Python RuntimeError

Posted: Wed Feb 15, 2012 6:16 am
by selfdestructo

I'm having a problem here importing a MorphoML file generated by NEURON itself (NEURON -- VERSION 7.3 (581:b1b7836b8bab) b1b7836b8bab) in Python. I've built nrnpython against a macports build of Python 2.7 using this recipe: ... n-mac-os-x.
The problem is that the python classes neuron.neuroml.rdxml is not found, apparently. I see these files are located in my Applications folder, but should these not be installed in /site-packages/neuron together with the neuron module? Is there simply another file that needs loading before calling Import3d.input('C030796A-P1.xml')?

Consider the following code;

Code: Select all

#/usr/bin/env python
import neuron
neuron.h('objref this')
Import3d = neuron.h.Import3d_MorphML()
imprt = neuron.h.Import3d_GUI(Import3d, 0)
The error message;

Code: Select all

ImportError                               Traceback (most recent call last)
/Users/ehagen/Downloads/<string> in <module>()

ImportError: No module named neuroml.rdxml
NameError                                 Traceback (most recent call last)
/Users/ehagen/Downloads/<string> in <module>()

NameError: name 'rdxml' is not defined
NEURON: No attribute: rdxml
 near line 0
 objref this
oc_restore_code tobj_count=2 should be 1
RuntimeError                              Traceback (most recent call last)
/Users/ehagen/Downloads/<ipython-input-9-dd24556d4a2c> in <module>()
      7 Import3d = neuron.h.Import3d_MorphML()
----> 8 Import3d.input('C030796A-P1.xml')
      9 imprt = neuron.h.Import3d_GUI(Import3d, 0)
     10 imprt.instantiate(neuron.h.this)

RuntimeError: hoc error

Re: Import MorphML file in Python RuntimeError

Posted: Wed Feb 15, 2012 12:40 pm
by hines
Sorry about that. I see that I left out the neuroml package from the list in src/nrnpython/ which reads (third line from the bottom)

Code: Select all

edit this and add 'neuron.neuroml' to the list and rerun or else just copy the nrn/share/lib/python/neuron/neuroml folder into where neuron.tests ended up.
Meanwhile, I'll make the change to and push to the repository.

Re: Import MorphML file in Python RuntimeError

Posted: Thu Feb 16, 2012 9:37 am
by selfdestructo
Thanks a lot, that solved my problem, files with the NeuroML v 1.8.1 specification can now be loaded.

There is another problem though, which should perhaps be discussed elsewhere; somatic sections are apperently missing/renamed, so the root of the morphology is on the first dendritic section, like

Code: Select all


|-|       dend_0[0](0-1)
   `|       dend_0[1](0-1)
     `|       dend_0[2](0-1)
I tried this with Migliore's CA1 neuron, and some morphology from, and it happens with both.

I understand the NeuroML spec is not converged yet, so this is not really important for me right now.


Re: Import MorphML file in Python RuntimeError

Posted: Thu Feb 16, 2012 10:10 am
by hines
It appears that CellBuilder is generating an obsolete NeuroML format. This will have to
be updated to be consistent with the new format generated by ModelView and read by the
python neuroml reader. Hopefully
there can be more shareing of export code between these two gui tools when I do the update.