<< Main Manual 

Tutorial #8. Building Multi-compartment Neurons

This tutorial assumes that you have completed Tutorial #7.

Creating a Network with Multi-compartment Neurons

NeuronetExperimenter facilitates the generation of multi-compartment neurons through a high-level Python extension package called nne.neuroml. As the name implies, the interface is also a library that controls the loading and saving of NeuroML files.

Like many other neural network simulators, mutli-compartment neurons are typically defined programmatically. However, contrary to many other simulator environments, the user-generated program typically just generates the native NeuronetExperimenter .net file. As we have seen, the .net file stores the network to be simulated in a declarative fashion, while as in previous tutorials, the biophysical equations are defined in the .oden files. 

Here is an non-trivial example of

tut8_example1.py:
from nne.neuroml import *

network = CellNetwork()

# create branching multicompartment neuron #1
neuron = Cell('CellA')
neuron.addCable('soma', 'CellA', 1, length=15, diameter=15)
neuron.addCable('dendrite1', 'CellA', 5, parent="soma", fract_along_parent=1.0, length=100, diameter=2)
neuron.addCable('dendrite2', 'CellA', 8, parent="soma", length=50, diameter=2)
neuron.addCable('dendrite3', 'CellA', 2, parent="dendrite2", length=50, diameter=1)
neuron.addCable('dendrite4', 'CellA', 3, parent="dendrite2", length=100, diameter=1)
neuron.addCable('axon', 'CellA', 1, parent="soma", length=200, diameter=1)
network.addCell(neuron)

# create multicompartment neuron #2
neuron2 = Cell('CellB')
neuron2.addCable('soma', 'CellA', 1)
neuron2.addCable('dendrite1', 'CellA', 3, parent="soma")
network.addCell(neuron2)

# create multicompartment neuron #3
neuron3 = Cell('CellC')
neuron3.addCable('soma', 'CellA', 1)
#    add multiple cables with the same parent and same number of segments
neuron3.addCables('dendrite', 'CellA', 4, parent="soma", numCables=5)
network.addCell(neuron3)

# create a clone of multicompartment neuron #2
neuron4 = neuron2.clone()
network.addCell(neuron4)

# make synaptic connections
network.addConnection('Excitatory', fromCell='CellA', toCell='CellC', fromCable='axon', toCable='dendrite1', latency=2.0, weight=0.5)
network.addConnection('Excitatory', fromCell='CellC', toCell='CellA', fromCable='soma', toCable='dendrite1', latency=0.0, weight=2.0)

# since there are two 'CellB's, this next function randomly selects one of the instances of CellB as the presynaptic cell and randomly selects a postsynaptic cell (this can result in autapses from small groups of 'CellB' like this example)
network.addConnection('Excitatory', fromCell='CellB', toCell='CellB', fromCable='soma', toCable='dendrite1', latency=0.0, weight=2.0)

# save in NeuronetExperimenter native format
network.save('blah.net')

# save in NeuroML format
network.save('blah2.xml')

lookup = network.getLookup()
print "Lookup1: " + str(lookup)

# load a new CellNetwork from XML
network2 = CellNetwork()
network2.load('blah2.xml')

lookup = network2.getLookup()
print "Lookup2: " + str(lookup)

# save the new network
network2.save('blah2.net')

An easier and more flexible way of adding multiple types is to use the Python scripts that came with NeuronetExperimenter. From the command-line

> cd NeuronetExperimenter-simulations
> python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from nne.Network import *             
# This allows us access to a Network object we will use to build our network
>>> network = Network()    
>>> network.addNeurons('zca', 10)
>>> network.addNeurons('Butera', 5)
>>> network.save('tut6_1.net')
Saving Network to: tut6_1.net
>>> quit()
>



<< Main Manual