Possible off-by-one bug in ModelView > Export to NeuroML
Posted: Wed Mar 20, 2019 9:48 pm
I'm running into an issue where when I try to export a model to NeuroML, it generates an XML file that refers to an incorrect parent segment (parent id is off-by-one).
Below are the steps to reproduce the issue:
Then in the resulting test.nml file, the bug is visible in the first few lines (last line below):
This also happens when there is more than one cell defined. E.g. the second cell's first segment that has the second cell's root segment as the parent, ends up referring to the last segment of the *first* cell.
This happens under Ubuntu 16.04 LTS, NEURON -- VERSION 7.5 master (6b4c19f) 2017-09-25
Below are the steps to reproduce the issue:
Code: Select all
# Download a model from ModelDB: https://github.com/ModelDBRepository/116094/archive/master.zip
# Extract, go to "LongDendrite" folder, and `nrnivmodl`
# Copy the lines below to a new file 'bug.py'
# Then launch NEURON with: `nrngui -python bug.py`
from neuron import h, gui
# Load a multi-compartment cell template
h.load_file('mitral.tem')
# Create an instance of the cell
cell1 = h.Mit(100)
h.define_shape()
# Manually: Tools > Model View > File > Export to NeuroML > Level 1 (or 2) > 'test.nml'
h.load_file('mview.hoc')
modelView = h.ModelView(0)
modelXml = h.ModelViewXML(modelView)
modelXml.xportLevel1('test.nml')
quit()
Code: Select all
<segments xmlns="http://morphml.org/morphml/schema">
<segment id="1" name = "Seg0_soma" cable = "0">
<proximal x="0" y="0" z="0" diameter="16.2338"/>
<distal x="50" y="0" z="0" diameter="16.2338"/>
</segment>
<segment id="2" name = "Seg1_soma" parent="1" cable = "0">
<distal x="100" y="0" z="0" diameter="16.2338"/>
</segment>
<segment id="209" name = "Seg0_s2p" parent="0" cable = "104"> <!-- Bug: parent="0" should be "1"-->
This happens under Ubuntu 16.04 LTS, NEURON -- VERSION 7.5 master (6b4c19f) 2017-09-25