Debian Codegraph @

examples/frompapers/Brette_2012/Fig5A.py

raw
1 '''
2 Brette R (2013). Sharpness of spike initiation in neurons explained by compartmentalization.
3 PLoS Comp Biol, doi: 10.1371/journal.pcbi.1003338.
4
5 Fig. 5A. Voltage trace for current injection, with an additional reset when a spike is produced.
6
7 Trick: to reset the entire neuron, we use a set of synapses from the spike initiation compartment where the
8 threshold condition applies to all compartments, and the reset operation (v = EL) is applied there every time
9 a spike is produced.
10 '''
11 from brian2 import *
12 from params import *
13
14 defaultclock.dt = 0.025*ms
15 duration = 500*ms
16
17 # Morphology
18 morpho = Soma(50*um) # chosen for a target Rm
19 morpho.axon = Cylinder(diameter=1*um, length=300*um, n=300)
20
21 # Input
22 taux = 5*ms
23 sigmax = 12*mV
24 xx0 = 7*mV
25
26 compartment = 40
27
28 # Channels
29 eqs = '''
30 Im = gL * (EL - v) + gNa * m * (ENa - v) + gLx * (xx0 + xx) : amp/meter**2
31 dm/dt = (minf - m) / taum : 1 # simplified Na channel
32 minf = 1 / (1 + exp((va - v) / ka)) : 1
33 gNa : siemens/meter**2
34 gLx : siemens/meter**2
35 dxx/dt = -xx / taux + sigmax * (2 / taux)**.5 *xi : volt
36 '''
37
38 neuron = SpatialNeuron(morphology=morpho, model=eqs, Cm=Cm, Ri=Ri,
39 threshold='m>0.5', threshold_location=compartment,
40 refractory=5*ms)
41 neuron.v = EL
42 neuron.gLx[0] = gL
43 neuron.gNa[compartment] = gNa_0 / neuron.area[compartment]
44
45 # Reset the entire neuron when there is a spike
46 reset = Synapses(neuron, neuron, on_pre='v = EL')
47 reset.connect('i == compartment') # Connects the spike initiation compartment to all compartments
48
49 # Monitors
50 S = SpikeMonitor(neuron)
51 M = StateMonitor(neuron, 'v', record=0)
52 run(duration, report='text')
53
54 # Add spikes for display
55 v = M[0].v
56 for t in S.t:
57 v[int(t / defaultclock.dt)] = 50*mV
58
59 plot(M.t/ms, v/mV, 'k')
60 tight_layout()
61 show()