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') |
> 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() > |