Source code for brainmodels.synapses.alpha

# -*- coding: utf-8 -*-

from .dual_exp import *

__all__ = [
  'AlphaCUBA', 'AlphaCOBA'
]


[docs]class AlphaCUBA(DualExpCUBA): r"""Current-based alpha synapse model. **Model Descriptions** The analytical expression of alpha synapse is given by: .. math:: g_{syn}(t)= g_{max} \frac{t-t_{s}}{\tau} \exp \left(-\frac{t-t_{s}}{\tau}\right). While, this equation is hard to implement. So, let's try to convert it into the differential forms: .. math:: \begin{aligned} &g_{\mathrm{syn}}(t)= g_{\mathrm{max}} g \\ &\frac{d g}{d t}=-\frac{g}{\tau}+h \\ &\frac{d h}{d t}=-\frac{h}{\tau}+\delta\left(t_{0}-t\right) \end{aligned} The current onto the post-synaptic neuron is given by .. math:: I_{syn}(t) = g_{\mathrm{syn}}(t). **Model Examples** .. plot:: :include-source: True >>> import brainpy as bp >>> import brainmodels >>> import matplotlib.pyplot as plt >>> >>> neu1 = brainmodels.neurons.LIF(1) >>> neu2 = brainmodels.neurons.LIF(1) >>> syn1 = brainmodels.synapses.AlphaCUBA(neu1, neu2, bp.connect.All2All()) >>> net = bp.Network(pre=neu1, syn=syn1, post=neu2) >>> >>> runner = bp.StructRunner(net, inputs=[('pre.input', 25.)], monitors=['pre.V', 'post.V', 'syn.g', 'syn.h']) >>> runner.run(150.) >>> >>> fig, gs = bp.visualize.get_figure(2, 1, 3, 8) >>> fig.add_subplot(gs[0, 0]) >>> plt.plot(runner.mon.ts, runner.mon['pre.V'], label='pre-V') >>> plt.plot(runner.mon.ts, runner.mon['post.V'], label='post-V') >>> plt.legend() >>> fig.add_subplot(gs[1, 0]) >>> plt.plot(runner.mon.ts, runner.mon['syn.g'], label='g') >>> plt.plot(runner.mon.ts, runner.mon['syn.h'], label='h') >>> plt.legend() >>> plt.show() **Model Parameters** ============= ============== ======== =================================================================================== **Parameter** **Init Value** **Unit** **Explanation** ------------- -------------- -------- ----------------------------------------------------------------------------------- delay 0 ms The decay length of the pre-synaptic spikes. tau_decay 2 ms The decay time constant of the synaptic state. g_max .2 µmho(µS) The maximum conductance. ============= ============== ======== =================================================================================== **Model Variables** ================== ================= ========================================================= **Variables name** **Initial Value** **Explanation** ------------------ ----------------- --------------------------------------------------------- g 0 Synapse conductance on the post-synaptic neuron. h 0 Gating variable. pre_spike False The history spiking states of the pre-synaptic neurons. ================== ================= ========================================================= **References** .. [1] Sterratt, David, Bruce Graham, Andrew Gillies, and David Willshaw. "The Synapse." Principles of Computational Modelling in Neuroscience. Cambridge: Cambridge UP, 2011. 172-95. Print. """
[docs] def __init__(self, pre, post, conn, delay=0., g_max=1., tau_decay=10.0, method='exp_auto', name=None): super(AlphaCUBA, self).__init__(pre=pre, post=post, conn=conn, delay=delay, g_max=g_max, tau_decay=tau_decay, tau_rise=tau_decay, method=method, name=name)
[docs]class AlphaCOBA(DualExpCOBA): """Conductance-based alpha synapse model. **Model Descriptions** The conductance-based alpha synapse model is similar with the `current-based alpha synapse model <./brainmodels.synapses.AlphaCUBA.rst>`_, except the expression which output onto the post-synaptic neurons: .. math:: I_{syn}(t) = g_{\mathrm{syn}}(t) (V(t)-E) where :math:`V(t)` is the membrane potential of the post-synaptic neuron, :math:`E` is the reversal potential. **Model Examples** .. plot:: :include-source: True >>> import brainpy as bp >>> import brainmodels >>> import matplotlib.pyplot as plt >>> >>> neu1 = brainmodels.neurons.HH(1) >>> neu2 = brainmodels.neurons.HH(1) >>> syn1 = brainmodels.synapses.AlphaCOBA(neu1, neu2, bp.connect.All2All(), E=0.) >>> net = bp.Network(pre=neu1, syn=syn1, post=neu2) >>> >>> runner = bp.StructRunner(net, inputs=[('pre.input', 5.)], monitors=['pre.V', 'post.V', 'syn.g', 'syn.h']) >>> runner.run(150.) >>> >>> fig, gs = bp.visualize.get_figure(2, 1, 3, 8) >>> fig.add_subplot(gs[0, 0]) >>> plt.plot(runner.mon.ts, runner.mon['pre.V'], label='pre-V') >>> plt.plot(runner.mon.ts, runner.mon['post.V'], label='post-V') >>> plt.legend() >>> fig.add_subplot(gs[1, 0]) >>> plt.plot(runner.mon.ts, runner.mon['syn.g'], label='g') >>> plt.plot(runner.mon.ts, runner.mon['syn.h'], label='h') >>> plt.legend() >>> plt.show() **Model Parameters** ============= ============== ======== =================================================================================== **Parameter** **Init Value** **Unit** **Explanation** ------------- -------------- -------- ----------------------------------------------------------------------------------- delay 0 ms The decay length of the pre-synaptic spikes. tau_decay 2 ms The decay time constant of the synaptic state. g_max .2 µmho(µS) The maximum conductance. E 0 mV The reversal potential for the synaptic current. ============= ============== ======== =================================================================================== **Model Variables** ================== ================= ========================================================= **Variables name** **Initial Value** **Explanation** ------------------ ----------------- --------------------------------------------------------- g 0 Synapse conductance on the post-synaptic neuron. h 0 Gating variable. pre_spike False The history spiking states of the pre-synaptic neurons. ================== ================= ========================================================= **References** .. [1] Sterratt, David, Bruce Graham, Andrew Gillies, and David Willshaw. "The Synapse." Principles of Computational Modelling in Neuroscience. Cambridge: Cambridge UP, 2011. 172-95. Print. """
[docs] def __init__(self, pre, post, conn, delay=0., g_max=1., tau_decay=10.0, E=0., method='exp_auto', name=None): super(AlphaCOBA, self).__init__(pre=pre, post=post, conn=conn, delay=delay, g_max=g_max, E=E, tau_decay=tau_decay, tau_rise=tau_decay, method=method, name=name)