Import MorphML file in Python RuntimeError

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
selfdestructo
Posts: 32
Joined: Wed Oct 14, 2009 11:12 am

Import MorphML file in Python RuntimeError

Post by selfdestructo » Wed Feb 15, 2012 6:16 am

Hi,

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: http://compneuro.umb.no/LFPy/informatio ... 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.load_file('stdlib.hoc')
neuron.h.load_file('import3d.hoc')
neuron.h('objref this')
Import3d = neuron.h.Import3d_MorphML()
Import3d.input('C030796A-P1.xml')
imprt = neuron.h.Import3d_GUI(Import3d, 0)
imprt.instantiate(neuron.h.this)
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
            ^
        Import3d_MorphML[1].input("C030796A-P1.xml")
oc_restore_code tobj_count=2 should be 1
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/Users/ehagen/Downloads/<ipython-input-9-dd24556d4a2c> in <module>()
      6 
      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
Cheers,
Espen

hines
Site Admin
Posts: 1575
Joined: Wed May 18, 2005 3:32 pm

Re: Import MorphML file in Python RuntimeError

Post by hines » Wed Feb 15, 2012 12:40 pm

Sorry about that. I see that I left out the neuroml package from the list in src/nrnpython/setup.py which reads (third line from the bottom)

Code: Select all

      packages=['neuron','neuron.tests'],
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 setup.py.in and push to the repository.

selfdestructo
Posts: 32
Joined: Wed Oct 14, 2009 11:12 am

Re: Import MorphML file in Python RuntimeError

Post by selfdestructo » Thu Feb 16, 2012 9:37 am

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

neuron.h.topology()

|-|       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 NeuroMorpho.org, and it happens with both.

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

Best,
Espen

hines
Site Admin
Posts: 1575
Joined: Wed May 18, 2005 3:32 pm

Re: Import MorphML file in Python RuntimeError

Post by hines » Thu Feb 16, 2012 10:10 am

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.

Post Reply