FacetsPythonCourse2008: synfire_chains.py

File synfire_chains.py, 1.0 kB (added by goodman, 7 months ago)
Line 
1 '''
2 Synfire chains (from Diesmann et al, 1999)
3 '''
4 from brian import *
5 # Neuron model parameters
6 Vr = -70*mV
7 Vt = -55*mV
8 taum = 10*ms
9 taupsp = 0.325*ms
10 weight = 4.86 * mV
11 # Neuron model
12 eqs=Equations('''
13 dV/dt=(-(V-Vr)+x)*(1./taum) : volt
14 dx/dt=(-x+y)*(1./taupsp) : volt
15 dy/dt=-y*(1./taupsp)+25.27*mV/ms+\
16     (39.24*mV/ms**0.5)*xi : volt
17 ''')
18 # Neuron groups
19 P = NeuronGroup(N=1000, model=eqs,
20     threshold=Vt,reset=Vr,refractory=1*ms)
21 Pinput = PulsePacket(t=50*ms,n=85,sigma=1*ms)
22 # The network structure
23 Pgp = [ P.subgroup(100) for i in range(10)]
24 C = Connection(P,P,'y')
25 for i in range(9):
26     C.connect_full(Pgp[i],Pgp[i+1],weight)
27 Cinput = Connection(Pinput,P,'y')
28 Cinput.connect_full(Pinput,Pgp[0],weight)
29 # Record the spikes
30 Mgp = [SpikeMonitor(p,record=True) for p in Pgp]
31 Minput = SpikeMonitor(Pinput,record=True)
32 monitors = [Minput]+Mgp
33 # Setup the network, and run it
34 P.V = Vr + rand(len(P)) * (Vt-Vr)
35 run(100*ms)
36 # Plot result
37 raster_plot(showgrouplines=True,*monitors)
38 show()