NEURON and NeuroML#

NEURON logo

NEURON is a widely used simulation environment and is one of the main target platforms for a standard facilitating exchange of neuronal models.

Simulating NeuroML models in NEURON#

jNeuroML or pyNeuroML can be used to convert NeuroML2/LEMS models to NEURON. This involves pointing at a LEMS Simulation file describing what to simulate, and using the -neuron option:

# Simulate the model using NEURON with python/hoc/mod files generated by jNeuroML
jnml <LEMS simulation file> -neuron -run

# Simulate the model using NEURON with python/hoc/mod files generated by pyNeuroML
pynml <LEMS simulation file> -neuron -run

These commands generate a PyNeuron script and run it (a file ending in _nrn.py). So you must have NEURON installed on your system, with its Python bindings (PyNeuron). Skipping the -run flag will generate the Python script but will not run it: you can run it manually later. Adding -nogui will suppress the NEURON graphical elements/menu opening and just run the model in NEURON in the background

You can also run LEMS simulations using the NEURON simulator using the pyNeuroML API:

from pyneuroml.pynml import run_lems_with_jneuroml_neuron

...

run_lems_with_jneuroml_neuron(lems_file_name)

Setting the NEURON_HOME environment variable#

Since it is possible to install multiple versions of NEURON in different places, the NeuroML tools need to be told where the NEURON tools are. To do this, they look at the NEURON_HOME environment variable. This needs to hold the path to where the binary (bin) folder holding the NEURON tools such as nrniv are located. On Linux like systems, one can use which to find these tools and set the variable:

$ which nrniv
~/.local/share/virtualenvs/neuroml-311-dev/bin/nrniv

$ export NEURON_HOME="~/.local/share/virtualenvs/neuroml-311-dev/"

One can combine these commands together also:

$ export NEURON_HOME="$(dirname $(dirname $(which nrniv)))"

Using neuroConstruct#

NEURON simulations can also be generated from NeuroML model components by neuroConstruct, but most of this functionality is related to NeuroML v1.