| 1 |
# encoding: utf8 |
| 2 |
""" |
| 3 |
Morris-Lecar model |
| 4 |
|
| 5 |
Reproduces Fig. 9 of: |
| 6 |
|
| 7 |
Catherine Morris and Harold Lecar. |
| 8 |
“Voltage Oscillations in the Barnacle Giant Muscle Fiber.” |
| 9 |
Biophysical Journal 35, no. 1 (1981): 193–213. |
| 10 |
""" |
| 11 |
from brian2 import * |
| 12 |
set_device('cpp_standalone') |
| 13 |
defaultclock.dt = 0.01*ms |
| 14 |
|
| 15 |
g_L = 2*mS |
| 16 |
g_Ca = 4*mS |
| 17 |
g_K = 8*mS |
| 18 |
V_L = -50*mV |
| 19 |
V_Ca = 100*mV |
| 20 |
V_K = -70*mV |
| 21 |
lambda_n__max = 1.0/(15*ms) |
| 22 |
V_1 = 10*mV |
| 23 |
V_2 = 15*mV # Note that Figure caption says -15 which seems to be a typo |
| 24 |
V_3 = -1*mV |
| 25 |
V_4 = 14.5*mV |
| 26 |
C = 20*uF |
| 27 |
|
| 28 |
|
| 29 |
# V,N-reduced system (Eq. 9 in article), note that the variables M and N (and lambda_N, etc.) |
| 30 |
# have been renamed to m and n to better match the Hodgkin-Huxley convention, and because N has |
| 31 |
# a reserved meaning in Brian (number of neurons) |
| 32 |
eqs = ''' |
| 33 |
dV/dt = (-g_L*(V - V_L) - g_Ca*m_inf*(V - V_Ca) - g_K*n*(V - V_K) + I)/C : volt |
| 34 |
dn/dt = lambda_n*(n_inf - n) : 1 |
| 35 |
m_inf = 0.5*(1 + tanh((V - V_1)/V_2)) : 1 |
| 36 |
n_inf = 0.5*(1 + tanh((V - V_3)/V_4)) : 1 |
| 37 |
lambda_n = lambda_n__max*cosh((V - V_3)/(2*V_4)) : Hz |
| 38 |
I : amp |
| 39 |
''' |
| 40 |
|
| 41 |
neuron = NeuronGroup(17, eqs, method='exponential_euler') |
| 42 |
neuron.I = (np.arange(17)*25+100)*uA |
| 43 |
neuron.V = V_L |
| 44 |
neuron.n = 'n_inf' |
| 45 |
mon = StateMonitor(neuron, ['V', 'n'], record=True) |
| 46 |
|
| 47 |
run_time = 220*ms |
| 48 |
run(run_time) |
| 49 |
fig, (ax1, ax2) = plt.subplots(1, 2, gridspec_kw={'right': 0.95, 'bottom': 0.15}, |
| 50 |
figsize=(6.4, 3.2)) |
| 51 |
fig.subplots_adjust(wspace=0.4) |
| 52 |
for line_no, idx in enumerate([0, 4, 12, 15]): |
| 53 |
color = 'C%d' % line_no |
| 54 |
ax1.plot(mon.t/ms, mon.V[idx]/mV, color=color) |
| 55 |
ax1.text(225, mon.V[idx][-1]/mV, '%.0f' % (neuron.I[idx]/uA), color=color) |
| 56 |
ax1.set(xlim=(0, 220), ylim=(-50, 50), xlabel='time (ms)') |
| 57 |
ax1.set_ylabel('V (mV)', rotation=0) |
| 58 |
ax1.spines['right'].set_visible(False) |
| 59 |
ax1.spines['top'].set_visible(False) |
| 60 |
|
| 61 |
# dV/dt nullclines |
| 62 |
V = linspace(-50, 50, 100)*mV |
| 63 |
for line_no, (idx, color) in enumerate([(0, 'C0'), (4, 'C1'), (8, 'C4'), (12, 'C2'), (16, 'C5')]): |
| 64 |
n_null = (g_L*(V - V_L) + g_Ca*0.5*(1 + tanh((V - V_1)/V_2))*(V - V_Ca) - neuron.I[idx])/(-g_K*(V - V_K)) |
| 65 |
ax2.plot(V/mV, n_null, color=color) |
| 66 |
ax2.text(V[20+5*line_no]/mV, n_null[20+5*line_no]+0.01, '%.0f' % (neuron.I[idx]/uA), color=color) |
| 67 |
# dn/dt nullcline |
| 68 |
n_null = 0.5*(1 + tanh((V - V_3)/V_4)) |
| 69 |
ax2.plot(V/mV, n_null, color='k') |
| 70 |
ax2.set(xlim=(-50, 50), ylim=(0, 1), xlabel='V (mV)') |
| 71 |
ax2.set_ylabel('n', rotation=0) |
| 72 |
ax2.spines['right'].set_visible(False) |
| 73 |
ax2.spines['top'].set_visible(False) |
| 74 |
plt.show() |