FacetsPythonCourse2008: minimalexample.py

File minimalexample.py, 0.5 kB (added by goodman, 7 months ago)
Line 
1 '''
2 Very short example program.
3 '''
4 from brian import *
5
6 eqs='''
7 dv/dt = (ge+gi-(v+49*mV))/(20*ms) : volt
8 dge/dt = -ge/(5*ms) : volt
9 dgi/dt = -gi/(10*ms) : volt
10 '''
11
12 P=NeuronGroup(4000,model=eqs,
13               threshold=-50*mV,reset=-60*mV)
14 P.v=-60*mV+10*mV*rand(len(P))
15 Pe=P.subgroup(3200)
16 Pi=P.subgroup(800)
17
18 Ce=Connection(Pe,P,'ge')
19 Ci=Connection(Pi,P,'gi')
20 Ce.connect_random(Pe, P, 0.02,weight=1.62*mV)
21 Ci.connect_random(Pi, P, 0.02,weight=-9*mV)
22
23 M=SpikeMonitor(P)
24
25 run(1*second)
26 raster_plot(M)
27 show()