2013/uns13/resources: nengo_integrator.py

File nengo_integrator.py, 1.1 KB (added by francesco.galluppi, 5 years ago)

Nengo/SpiNNaker integrator example

Line 
1"""
2integrator example for nengo/spinnaker
3
4A->B->C implementing an integrator in the B node, which is self connected.
5
6Results can be viewed using the following command:
7./nengo-cl nengo_spinnaker_interface/viewer_1d.py -b spinn-1 -d 1 -s 2
8"""
9import nef
10
11# importing the Nengo/SpiNNakerinterface module
12import nengo_spinnaker_interface.spinn as spinn
13
14net=nef.Network('SpiNN Integrator',quick=False)
15
16
17input=net.make_input('input',[0])
18
19
20tau_syn = .2
21
22n = 100
23
24A=net.make('A', neurons=n, dimensions=1, max_rate=(120,150), intercept=(-.90,.90))
25B=net.make('B', neurons=n*2, dimensions=1, max_rate=(120,150), intercept=(-.90,.90))
26C=net.make('C', neurons=n, dimensions=1, max_rate=(120,150), intercept=(-.90,.90))
27
28
29net.connect(input,A,pstc=.001)
30net.connect(A,B,pstc=tau_syn, weight=tau_syn)
31net.connect(B,B,pstc=tau_syn)
32net.connect(B,C)
33
34s=spinn.SpiNN(net.network)      # instantiates a SpiNNaker/NEF network
35s.print_info()                  # prints informations about the nodes
36s.write_to_file('nengo_spinnaker_interface/nengo_values.py')    # dumps network values into a python file
37