NEURON + Python
This cookbook section is devoted to recipes for using Python to control the NEURON simulator.
Installation
The best instructions for the installation of a Python enabled NEURON is available here
Using your custom NMODL files
Run nrnmodliv (part of the NEURON installation) as usual in a directory containing mod-files.
This creates a directory called 'i686' ('x86_64' on 64bit platforms) which contains compiled versions of the mod-files, and the directory 'i686/.libs' ('x86_64/.libs') contains the file 'libnrnmech.so'.
Running python in the parent directory of 'i686' ('x86_64') will include the compiled mod-file models automatically.
Compiled mod-file models can also be loaded dynamically on the fly as follows:
from neuron import h
h.nrn_load_dll('$MY_NMODL_DIR/i686/.libs/libnrnmech.so')
Where $MY_NMODL_DIR is replaced by the appropriate absolute path to the directory containing the mod-files, where nrnmodliv was run to compile them.
Insert models as usual ... the 'SUFFIX' directive in the mod-file gives its mechanism name.
Example:
In the mod-file:
... SUFFIX hh2
After building and loading the mechanisms as described above, we can
soma = h.Section()
soma.insert('hh2')
NEURON+Python Forum
The official NEURON+Python forum is here
Bug reports
At present, it is recommended to use the official NEURON+Python forum to report bugs and issues.

