NeuroML/Documentation

OLM example: `NEURON: subscript out of range a_pop0`

sanjayankur31 opened this issue · 0 comments

Describe the bug
I was tinkering with the OLM example and noticed that Neuron throws an error (but continues and does record the data etc.) related to the instance in the populationList:

$ python LEMS_olm_example_sim_nrn.py 

    Starting simulation in NEURON of 600ms generated from NeuroML2 model...

Population pop0 contains 1 instance(s) of component: olm of type: cell
        1 
NEURON: subscript out of range a_pop0
 near line 1
 { a_pop0[1].position(0.0, 0.0, 0.0) }
                                      ^
Setting up the network to simulate took 0.004180 seconds
Running a simulation of 600.0ms (dt = 0.01ms; seed=123)
Finished NEURON simulation in 0.169157 seconds (0.002819 mins)...
Saving results at t=599.9999999995268...
Saved data to: time.dat
Saved data to: olm_example_sim.dat
Finished saving results in 0.263786 seconds
Done

The XML snipped is here:

https://github.com/NeuroML/Documentation/blob/master/source/Userdocs/NML2_examples/olm_example_net.nml#L8

The size of the population is given as 1 and the first instance there has an id of 1:

https://github.com/NeuroML/Documentation/blob/master/source/Userdocs/NML2_examples/olm_example_net.nml#L10

The corresponding line in the _nrn.py file is:

       h("{ a_pop0[1].position(0.0, 0.0, 0.0) }")

So, it looks like the NeuronWriter takes the id of the instance as the index instead of counting through them from 0?

What is correct here? Should id always start from 0, and be contiguous, or should the NeuronWriter not use the id but have its own counter to allow any values for id to be used?

Page on which issue is
The OLM example code

This is probably a NeuronWriter bug, but opening it here for initial discussion.