Debian Codegraph @

examples/frompapers/Brette_2012/Fig4.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. 4E-F. Spatial distribution of Na channels. Tapering axon near soma.
6
7 """
8 from brian2 import *
9 from params import *
10
11 defaultclock.dt = 0.025*ms
12
13 # Morphology
14 morpho = Soma(50*um) # chosen for a target Rm
15 # Tapering (change this for the other figure panels)
16 diameters = hstack([linspace(4, 1, 11), ones(290)])*um
17 morpho.axon = Section(diameter=diameters, length=ones(300)*um, n=300)
18
19 # Na channels
20 Na_start = (25 + 10)*um
21 Na_end = (40 + 10)*um
22 linear_distribution = True # True is F, False is E
23
24 duration = 500*ms
25
26 # Channels
27 eqs='''
28 Im = gL*(EL - v) + gclamp*(vc - v) + gNa*m*(ENa - v) : amp/meter**2
29 dm/dt = (minf - m) / taum: 1 # simplified Na channel
30 minf = 1 / (1 + exp((va - v) / ka)) : 1
31 gclamp : siemens/meter**2
32 gNa : siemens/meter**2
33 vc = EL + 50*mV * t / duration : volt (shared) # Voltage clamp with a ramping voltage command
34 '''
35
36 neuron = SpatialNeuron(morphology=morpho, model=eqs, Cm=Cm, Ri=Ri,
37 method="exponential_euler")
38 compartments = morpho.axon[Na_start:Na_end]
39 neuron.v = EL
40 neuron.gclamp[0] = gL*500
41
42 if linear_distribution:
43 profile = linspace(1, 0, len(compartments))
44 else:
45 profile = ones(len(compartments))
46 profile = profile / sum(profile) # normalization
47
48 neuron.gNa[compartments] = gNa_0 * profile / neuron.area[compartments]
49
50 # Monitors
51 mon = StateMonitor(neuron, 'v', record=True)
52
53 run(duration, report='text')
54
55 dt_per_volt = len(mon.t) / (50*mV)
56 for v in [-64*mV, -61*mV, -58*mV, -55*mV, -52*mV]:
57 plot(mon.v[:100, int(dt_per_volt * (v - EL))]/mV, 'k')
58 xlim(0, 50+10)
59 ylim(-65, -25)
60 ylabel('V (mV)')
61 xlabel('Location (um)')
62 title('Voltage across axon')
63 tight_layout()
64 show()