70 likes | 321 Views
Brian. A clock driven simulator for spiking neural networks in Python. What? Why?. Simulator package for the Python programming language Much easier to learn and use (compared to things like Neuron, NEST, C++) Flexible Easy to extend. Brian in action. from Brian import *
E N D
Brian A clock driven simulator for spiking neural networks in Python
What? Why? • Simulator package for the Python programming language • Much easier to learn and use (compared to things like Neuron, NEST, C++) • Flexible • Easy to extend
Brian in action from Brian import * dv = lambda v,ge,gi: (ge+gi-(v+49*mV))/(20*ms) dge = lambda v,ge,gi: -ge/(5*ms) dgi = lambda v,ge,gi: -gi/(10*ms) P = NeuronGroup(4000,model=(dv,dge,dgi),threshold=-50*mV, reset=-60*mV,init=(-60*mV,0*mV,0*mV)) Pe = P.subgroup(3200) Pi = P.subgroup(800) Ce = Connection(Pe, P, 'ge') Ci = Connection(Pi, P, 'gi') Ce.connectRandom(Pe, P, 0.02, weight=1.62*mV) Ci.connectRandom(Pi, P, 0.02, weight=-9*mV) M = SpikeMonitor(P,True) Mv = StateMonitor(P,'v',record=0) run(1*second) plot(Mv.times,Mv[0]) rasterPlot(M) show() Ci P Pi Pe Ce
Brian in action 2 Vr = -70*mV Vt = -55*mV taum = 10*ms taupsp = 0.325*ms weight = 4.86 * mV dV = lambda V,x,y: (-(V-Vr)+x)*(1./taum) dx = lambda V,x,y: (-x+y)*(1./taupsp) dy = lambda V,x,y: -y*(1./taupsp)+25.27*mV/ms+(39.24*mV/ms**0.5)*xi P = NeuronGroup(N=1000, model=(dV,dx,dy),init=(0*volt,0*volt,0*volt), threshold=Vt,reset=Vr,refractory=1*ms) Pinput = PulsePacket(t=50*ms,n=85,sigma=1*ms) Pgp = [ P.subgroup(100) for i in range(10)] C = Connection(P,P,'y') for i in range(9): C.connectFull(Pgp[i],Pgp[i+1],weight) Cinput = Connection(Pinput,P,'y') Cinput.connectFull(Pinput,Pgp[0],weight) Mgp = [SpikeMonitor(p,record=True) for p in Pgp] Minput = SpikeMonitor(Pinput,record=True) monitors = [Minput]+Mgp P.V = Vr + rand(len(P)) * (Vt-Vr) run(100*ms) rasterPlot(showgrouplines=True,*monitors) Pulse Packet Pgp[0] Pgp[1] Pgp[9] Mgp[0] Mgp[1] Mgp[9]
Features • Neuron models (DE, stochastic DE, ion channels, alpha functions, etc.) • Analysis and plotting with NumPy/PyLab • Unit checking • Interactive simulations with Python shell • Automatic optimisation (code generation)
How it works • Model • Threshold • Reset • NeuronGroup • Connection • Network
Things still to do • STDP • Speed – more automatic code generation • Distributed computing, GPU • Multi-compartmental models • Static analysis • Standardisation (PyNN, NeuroML, FacetsML) • Realtime plotting • Database