| 1 |
""" |
| 2 |
Synaptic model with continuous interaction |
| 3 |
------------------------------------------ |
| 4 |
|
| 5 |
This example implements a conductance base synapse that is continuously linking |
| 6 |
two neurons, i.e. the synaptic gating variable updates at each time step. |
| 7 |
Two Reduced Traub-Miles Model (RTM) neurons are connected to each other |
| 8 |
through a directed synapse from neuron 1 to 2. |
| 9 |
|
| 10 |
Here, the complexity stems from the fact that the synaptic conductance is a |
| 11 |
continuous function of the membrane potential, instead of being triggered by |
| 12 |
individual spikes. This can be useful in particular when analyzing models |
| 13 |
mathematically but it is not recommended in most cases because they tend to be |
| 14 |
less efficient. Also note that this model only works with (pre-synaptic) neuron |
| 15 |
models that model the action potential in detail, i.e. not with |
| 16 |
integrate-and-fire type models. |
| 17 |
|
| 18 |
There are two broad approaches (``s`` as part of the pre-synaptic neuron or |
| 19 |
``s`` as part of the Synapses object), all depends on whether the time |
| 20 |
constants are the same across all synapses or whether they can vary between |
| 21 |
synapses. In this example, the time constant is assumed to be the same and |
| 22 |
``s`` is therefore part of the pre-synaptic neuron model. |
| 23 |
|
| 24 |
References: |
| 25 |
|
| 26 |
- Introduction to modeling neural dynamics, Börgers, chapter 20 |
| 27 |
- `Discussion in Brian forum <https://brian.discourse.group/t/how-to-implement-a-conductance-base-synapse/77/2>`_ |
| 28 |
""" |
| 29 |
from brian2 import * |
| 30 |
|
| 31 |
I_e = 1.5*uA |
| 32 |
simulation_time = 100*ms |
| 33 |
# neuron RTM parameters |
| 34 |
El = -67 * mV |
| 35 |
EK = -100 * mV |
| 36 |
ENa = 50 * mV |
| 37 |
ESyn = 0 * mV |
| 38 |
gl = 0.1 * msiemens |
| 39 |
gK = 80 * msiemens |
| 40 |
gNa = 100 * msiemens |
| 41 |
|
| 42 |
C = 1 * ufarad |
| 43 |
|
| 44 |
weight = 0.25 |
| 45 |
gSyn = 1.0 * msiemens |
| 46 |
tau_d = 2 * ms |
| 47 |
tau_r = 0.2 * ms |
| 48 |
|
| 49 |
# forming RTM model with differential equations |
| 50 |
eqs = """ |
| 51 |
alphah = 0.128 * exp(-(vm + 50.0*mV) / (18.0*mV))/ms :Hz |
| 52 |
alpham = 0.32/mV * (vm + 54*mV) / (1.0 - exp(-(vm + 54.0*mV) / (4.0*mV)))/ms:Hz |
| 53 |
alphan = 0.032/mV * (vm + 52*mV) / (1.0 - exp(-(vm + 52.0*mV) / (5.0*mV)))/ms:Hz |
| 54 |
|
| 55 |
betah = 4.0 / (1.0 + exp(-(vm + 27.0*mV) / (5.0*mV)))/ms:Hz |
| 56 |
betam = 0.28/mV * (vm + 27.0*mV) / (exp((vm + 27.0*mV) / (5.0*mV)) - 1.0)/ms:Hz |
| 57 |
betan = 0.5 * exp(-(vm + 57.0*mV) / (40.0*mV))/ms:Hz |
| 58 |
|
| 59 |
membrane_Im = I_ext + gNa*m**3*h*(ENa-vm) + |
| 60 |
gl*(El-vm) + gK*n**4*(EK-vm) + gSyn*s_in*(-vm): amp |
| 61 |
I_ext : amp |
| 62 |
s_in : 1 |
| 63 |
|
| 64 |
dm/dt = alpham*(1-m)-betam*m : 1 |
| 65 |
dn/dt = alphan*(1-n)-betan*n : 1 |
| 66 |
dh/dt = alphah*(1-h)-betah*h : 1 |
| 67 |
|
| 68 |
ds/dt = 0.5 * (1 + tanh(0.1*vm/mV)) * (1-s)/tau_r - s/tau_d : 1 |
| 69 |
|
| 70 |
dvm/dt = membrane_Im/C : volt |
| 71 |
""" |
| 72 |
|
| 73 |
neuron = NeuronGroup(2, eqs, method="exponential_euler") |
| 74 |
|
| 75 |
# initialize variables |
| 76 |
neuron.vm = [-70.0, -65.0]*mV |
| 77 |
neuron.m = "alpham / (alpham + betam)" |
| 78 |
neuron.h = "alphah / (alphah + betah)" |
| 79 |
neuron.n = "alphan / (alphan + betan)" |
| 80 |
neuron.I_ext = [I_e, 0.0*uA] |
| 81 |
|
| 82 |
S = Synapses(neuron, |
| 83 |
neuron, |
| 84 |
's_in_post = weight*s_pre:1 (summed)') |
| 85 |
S.connect(i=0, j=1) |
| 86 |
|
| 87 |
# tracking variables |
| 88 |
st_mon = StateMonitor(neuron, ["vm", "s", "s_in"], record=[0, 1]) |
| 89 |
|
| 90 |
# running the simulation |
| 91 |
run(simulation_time) |
| 92 |
|
| 93 |
# plot the results |
| 94 |
fig, ax = plt.subplots(2, figsize=(10, 6), sharex=True, |
| 95 |
gridspec_kw={'height_ratios': (3, 1)}) |
| 96 |
|
| 97 |
ax[0].plot(st_mon.t/ms, st_mon.vm[0]/mV, |
| 98 |
lw=2, c="r", alpha=0.5, label="neuron 0") |
| 99 |
ax[0].plot(st_mon.t/ms, st_mon.vm[1]/mV, |
| 100 |
lw=2, c="b", alpha=0.5, label='neuron 1') |
| 101 |
ax[1].plot(st_mon.t/ms, st_mon.s[0], |
| 102 |
lw=2, c="r", alpha=0.5, label='s, neuron 0') |
| 103 |
ax[1].plot(st_mon.t/ms, st_mon.s_in[1], |
| 104 |
lw=2, c="b", alpha=0.5, label='s_in, neuron 1') |
| 105 |
ax[0].set(ylabel='v [mV]', xlim=(0, np.max(st_mon.t / ms)), |
| 106 |
ylim=(-100, 50)) |
| 107 |
ax[1].set(xlabel="t [ms]", ylabel="s", ylim=(0, 1)) |
| 108 |
|
| 109 |
ax[0].legend() |
| 110 |
ax[1].legend() |
| 111 |
|
| 112 |
plt.show() |