FacetsPythonCourse2008: synfire_chains.py

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