2121
2222
2323class HHLTC (HHTypeNeuLTC ):
24- r"""Hodgkin–Huxley neuron model.
24+ r"""Hodgkin–Huxley neuron model with liquid time constant .
2525
2626 **Model Descriptions**
2727
@@ -311,6 +311,176 @@ def return_for_delay(self):
311311
312312
313313class HH (HHLTC ):
314+ r"""Hodgkin–Huxley neuron model.
315+
316+ **Model Descriptions**
317+
318+ The Hodgkin-Huxley (HH; Hodgkin & Huxley, 1952) model [1]_ for the generation of
319+ the nerve action potential is one of the most successful mathematical models of
320+ a complex biological process that has ever been formulated. The basic concepts
321+ expressed in the model have proved a valid approach to the study of bio-electrical
322+ activity from the most primitive single-celled organisms such as *Paramecium*,
323+ right through to the neurons within our own brains.
324+
325+ Mathematically, the model is given by,
326+
327+ .. math::
328+
329+ C \frac {dV} {dt} = -(\bar{g}_{Na} m^3 h (V &-E_{Na})
330+ + \bar{g}_K n^4 (V-E_K) + g_{leak} (V - E_{leak})) + I(t)
331+
332+ \frac {dx} {dt} &= \alpha_x (1-x) - \beta_x, \quad x\in {\rm{\{m, h, n\}}}
333+
334+ &\alpha_m(V) = \frac {0.1(V+40)}{1-\exp(\frac{-(V + 40)} {10})}
335+
336+ &\beta_m(V) = 4.0 \exp(\frac{-(V + 65)} {18})
337+
338+ &\alpha_h(V) = 0.07 \exp(\frac{-(V+65)}{20})
339+
340+ &\beta_h(V) = \frac 1 {1 + \exp(\frac{-(V + 35)} {10})}
341+
342+ &\alpha_n(V) = \frac {0.01(V+55)}{1-\exp(-(V+55)/10)}
343+
344+ &\beta_n(V) = 0.125 \exp(\frac{-(V + 65)} {80})
345+
346+ The illustrated example of HH neuron model please see `this notebook <../neurons/HH_model.ipynb>`_.
347+
348+ The Hodgkin–Huxley model can be thought of as a differential equation system with
349+ four state variables, :math:`V_{m}(t),n(t),m(t)`, and :math:`h(t)`, that change
350+ with respect to time :math:`t`. The system is difficult to study because it is a
351+ nonlinear system and cannot be solved analytically. However, there are many numeric
352+ methods available to analyze the system. Certain properties and general behaviors,
353+ such as limit cycles, can be proven to exist.
354+
355+ *1. Center manifold*
356+
357+ Because there are four state variables, visualizing the path in phase space can
358+ be difficult. Usually two variables are chosen, voltage :math:`V_{m}(t)` and the
359+ potassium gating variable :math:`n(t)`, allowing one to visualize the limit cycle.
360+ However, one must be careful because this is an ad-hoc method of visualizing the
361+ 4-dimensional system. This does not prove the existence of the limit cycle.
362+
363+ .. image:: ../../../_static/Hodgkin_Huxley_Limit_Cycle.png
364+ :align: center
365+
366+ A better projection can be constructed from a careful analysis of the Jacobian of
367+ the system, evaluated at the equilibrium point. Specifically, the eigenvalues of
368+ the Jacobian are indicative of the center manifold's existence. Likewise, the
369+ eigenvectors of the Jacobian reveal the center manifold's orientation. The
370+ Hodgkin–Huxley model has two negative eigenvalues and two complex eigenvalues
371+ with slightly positive real parts. The eigenvectors associated with the two
372+ negative eigenvalues will reduce to zero as time :math:`t` increases. The remaining
373+ two complex eigenvectors define the center manifold. In other words, the
374+ 4-dimensional system collapses onto a 2-dimensional plane. Any solution
375+ starting off the center manifold will decay towards the *center manifold*.
376+ Furthermore, the limit cycle is contained on the center manifold.
377+
378+ *2. Bifurcations*
379+
380+ If the injected current :math:`I` were used as a bifurcation parameter, then the
381+ Hodgkin–Huxley model undergoes a Hopf bifurcation. As with most neuronal models,
382+ increasing the injected current will increase the firing rate of the neuron.
383+ One consequence of the Hopf bifurcation is that there is a minimum firing rate.
384+ This means that either the neuron is not firing at all (corresponding to zero
385+ frequency), or firing at the minimum firing rate. Because of the all-or-none
386+ principle, there is no smooth increase in action potential amplitude, but
387+ rather there is a sudden "jump" in amplitude. The resulting transition is
388+ known as a `canard <http://www.scholarpedia.org/article/Canards>`_.
389+
390+ .. image:: ../../../_static/Hodgkins_Huxley_bifurcation_by_I.gif
391+ :align: center
392+
393+ The following image shows the bifurcation diagram of the Hodgkin–Huxley model
394+ as a function of the external drive :math:`I` [3]_. The green lines show the amplitude
395+ of a stable limit cycle and the blue lines indicate unstable limit-cycle behaviour,
396+ both born from Hopf bifurcations. The solid red line shows the stable fixed point
397+ and the black line shows the unstable fixed point.
398+
399+ .. image:: ../../../_static/Hodgkin_Huxley_bifurcation.png
400+ :align: center
401+
402+ **Model Examples**
403+
404+ .. plot::
405+ :include-source: True
406+
407+ >>> import brainpy as bp
408+ >>> group = bp.neurons.HH(2)
409+ >>> runner = bp.DSRunner(group, monitors=['V'], inputs=('input', 10.))
410+ >>> runner.run(200.)
411+ >>> bp.visualize.line_plot(runner.mon.ts, runner.mon.V, show=True)
412+
413+ .. plot::
414+ :include-source: True
415+
416+ >>> import brainpy as bp
417+ >>> import brainpy.math as bm
418+ >>> import matplotlib.pyplot as plt
419+ >>>
420+ >>> group = bp.neurons.HH(2)
421+ >>>
422+ >>> I1 = bp.inputs.spike_input(sp_times=[500., 550., 1000, 1030, 1060, 1100, 1200], sp_lens=5, sp_sizes=5., duration=2000, )
423+ >>> I2 = bp.inputs.spike_input(sp_times=[600., 900, 950, 1500], sp_lens=5, sp_sizes=5., duration=2000, )
424+ >>> I1 += bp.math.random.normal(0, 3, size=I1.shape)
425+ >>> I2 += bp.math.random.normal(0, 3, size=I2.shape)
426+ >>> I = bm.stack((I1, I2), axis=-1)
427+ >>>
428+ >>> runner = bp.DSRunner(group, monitors=['V'], inputs=('input', I, 'iter'))
429+ >>> runner.run(2000.)
430+ >>>
431+ >>> fig, gs = bp.visualize.get_figure(1, 1, 3, 8)
432+ >>> fig.add_subplot(gs[0, 0])
433+ >>> plt.plot(runner.mon.ts, runner.mon.V[:, 0])
434+ >>> plt.plot(runner.mon.ts, runner.mon.V[:, 1] + 130)
435+ >>> plt.xlim(10, 2000)
436+ >>> plt.xticks([])
437+ >>> plt.yticks([])
438+ >>> plt.show()
439+
440+ Parameters
441+ ----------
442+ size: sequence of int, int
443+ The size of the neuron group.
444+ ENa: float, ArrayType, Initializer, callable
445+ The reversal potential of sodium. Default is 50 mV.
446+ gNa: float, ArrayType, Initializer, callable
447+ The maximum conductance of sodium channel. Default is 120 msiemens.
448+ EK: float, ArrayType, Initializer, callable
449+ The reversal potential of potassium. Default is -77 mV.
450+ gK: float, ArrayType, Initializer, callable
451+ The maximum conductance of potassium channel. Default is 36 msiemens.
452+ EL: float, ArrayType, Initializer, callable
453+ The reversal potential of learky channel. Default is -54.387 mV.
454+ gL: float, ArrayType, Initializer, callable
455+ The conductance of learky channel. Default is 0.03 msiemens.
456+ V_th: float, ArrayType, Initializer, callable
457+ The threshold of the membrane spike. Default is 20 mV.
458+ C: float, ArrayType, Initializer, callable
459+ The membrane capacitance. Default is 1 ufarad.
460+ V_initializer: ArrayType, Initializer, callable
461+ The initializer of membrane potential.
462+ m_initializer: ArrayType, Initializer, callable
463+ The initializer of m channel.
464+ h_initializer: ArrayType, Initializer, callable
465+ The initializer of h channel.
466+ n_initializer: ArrayType, Initializer, callable
467+ The initializer of n channel.
468+ method: str
469+ The numerical integration method.
470+ name: str
471+ The group name.
472+
473+ References
474+ ----------
475+
476+ .. [1] Hodgkin, Alan L., and Andrew F. Huxley. "A quantitative description
477+ of membrane current and its application to conduction and excitation
478+ in nerve." The Journal of physiology 117.4 (1952): 500.
479+ .. [2] https://en.wikipedia.org/wiki/Hodgkin%E2%80%93Huxley_model
480+ .. [3] Ashwin, Peter, Stephen Coombes, and Rachel Nicks. "Mathematical
481+ frameworks for oscillatory network dynamics in neuroscience."
482+ The Journal of Mathematical Neuroscience 6, no. 1 (2016): 1-92.
483+ """
314484 def dV (self , V , t , m , h , n , I ):
315485 I_Na = (self .gNa * m ** 3.0 * h ) * (V - self .ENa )
316486 I_K = (self .gK * n ** 4.0 ) * (V - self .EK )
@@ -330,7 +500,7 @@ def update(self, x=None):
330500
331501
332502class MorrisLecarLTC (HHTypeNeuLTC ):
333- r"""The Morris-Lecar neuron model.
503+ r"""The Morris-Lecar neuron model with liquid time constant .
334504
335505 **Model Descriptions**
336506
@@ -506,6 +676,78 @@ def return_for_delay(self):
506676
507677
508678class MorrisLecar (MorrisLecarLTC ):
679+ r"""The Morris-Lecar neuron model.
680+
681+ **Model Descriptions**
682+
683+ The Morris-Lecar model [4]_ (Also known as :math:`I_{Ca}+I_K`-model)
684+ is a two-dimensional "reduced" excitation model applicable to
685+ systems having two non-inactivating voltage-sensitive conductances.
686+ This model was named after Cathy Morris and Harold Lecar, who
687+ derived it in 1981. Because it is two-dimensional, the Morris-Lecar
688+ model is one of the favorite conductance-based models in computational neuroscience.
689+
690+ The original form of the model employed an instantaneously
691+ responding voltage-sensitive Ca2+ conductance for excitation and a delayed
692+ voltage-dependent K+ conductance for recovery. The equations of the model are:
693+
694+ .. math::
695+
696+ \begin{aligned}
697+ C\frac{dV}{dt} =& - g_{Ca} M_{\infty} (V - V_{Ca})- g_{K} W(V - V_{K}) -
698+ g_{Leak} (V - V_{Leak}) + I_{ext} \\
699+ \frac{dW}{dt} =& \frac{W_{\infty}(V) - W}{ \tau_W(V)}
700+ \end{aligned}
701+
702+ Here, :math:`V` is the membrane potential, :math:`W` is the "recovery variable",
703+ which is almost invariably the normalized :math:`K^+`-ion conductance, and
704+ :math:`I_{ext}` is the applied current stimulus.
705+
706+ **Model Examples**
707+
708+ .. plot::
709+ :include-source: True
710+
711+ >>> import brainpy as bp
712+ >>>
713+ >>> group = bp.neurons.MorrisLecar(1)
714+ >>> runner = bp.DSRunner(group, monitors=['V', 'W'], inputs=('input', 100.))
715+ >>> runner.run(1000)
716+ >>>
717+ >>> fig, gs = bp.visualize.get_figure(2, 1, 3, 8)
718+ >>> fig.add_subplot(gs[0, 0])
719+ >>> bp.visualize.line_plot(runner.mon.ts, runner.mon.W, ylabel='W')
720+ >>> fig.add_subplot(gs[1, 0])
721+ >>> bp.visualize.line_plot(runner.mon.ts, runner.mon.V, ylabel='V', show=True)
722+
723+
724+ **Model Parameters**
725+
726+ ============= ============== ======== =======================================================
727+ **Parameter** **Init Value** **Unit** **Explanation**
728+ ------------- -------------- -------- -------------------------------------------------------
729+ V_Ca 130 mV Equilibrium potentials of Ca+.(mV)
730+ g_Ca 4.4 \ Maximum conductance of corresponding Ca+.(mS/cm2)
731+ V_K -84 mV Equilibrium potentials of K+.(mV)
732+ g_K 8 \ Maximum conductance of corresponding K+.(mS/cm2)
733+ V_Leak -60 mV Equilibrium potentials of leak current.(mV)
734+ g_Leak 2 \ Maximum conductance of leak current.(mS/cm2)
735+ C 20 \ Membrane capacitance.(uF/cm2)
736+ V1 -1.2 \ Potential at which M_inf = 0.5.(mV)
737+ V2 18 \ Reciprocal of slope of voltage dependence of M_inf.(mV)
738+ V3 2 \ Potential at which W_inf = 0.5.(mV)
739+ V4 30 \ Reciprocal of slope of voltage dependence of W_inf.(mV)
740+ phi 0.04 \ A temperature factor. (1/s)
741+ V_th 10 mV The spike threshold.
742+ ============= ============== ======== =======================================================
743+
744+ References
745+ ----------
746+
747+ .. [4] Lecar, Harold. "Morris-lecar model." Scholarpedia 2.10 (2007): 1333.
748+ .. [5] http://www.scholarpedia.org/article/Morris-Lecar_model
749+ .. [6] https://en.wikipedia.org/wiki/Morris%E2%80%93Lecar_model
750+ """
509751 def dV (self , V , t , W , I ):
510752 M_inf = (1 / 2 ) * (1 + bm .tanh ((V - self .V1 ) / self .V2 ))
511753 I_Ca = self .g_Ca * M_inf * (V - self .V_Ca )
@@ -532,7 +774,7 @@ def update(self, x=None):
532774
533775
534776class WangBuzsakiModelLTC (HHTypeNeuLTC ):
535- r"""Wang-Buzsaki model [9]_, an implementation of a modified Hodgkin-Huxley model.
777+ r"""Wang-Buzsaki model [9]_, an implementation of a modified Hodgkin-Huxley model with liquid time constant .
536778
537779 Each model is described by a single compartment and obeys the current balance equation:
538780
@@ -722,6 +964,89 @@ def return_for_delay(self):
722964 return self .spike
723965
724966class WangBuzsakiModel (WangBuzsakiModelLTC ):
967+ r"""Wang-Buzsaki model [9]_, an implementation of a modified Hodgkin-Huxley model.
968+
969+ Each model is described by a single compartment and obeys the current balance equation:
970+
971+ .. math::
972+
973+ C_{m} \frac{d V}{d t}=-I_{\mathrm{Na}}-I_{\mathrm{K}}-I_{\mathrm{L}}-I_{\mathrm{syn}}+I_{\mathrm{app}}
974+
975+ where :math:`C_{m}=1 \mu \mathrm{F} / \mathrm{cm}^{2}` and :math:`I_{\mathrm{app}}` is the
976+ injected current (in :math:`\mu \mathrm{A} / \mathrm{cm}^{2}` ). The leak current
977+ :math:`I_{\mathrm{L}}=g_{\mathrm{L}}\left(V-E_{\mathrm{L}}\right)` has a conductance
978+ :math:`g_{\mathrm{L}}=0.1 \mathrm{mS} / \mathrm{cm}^{2}`, so that the passive time constant
979+ :math:`\tau_{0}=C_{m} / g_{\mathrm{L}}=10 \mathrm{msec} ; E_{\mathrm{L}}=-65 \mathrm{mV}`.
980+
981+ The spike-generating :math:`\mathrm{Na}^{+}` and :math:`\mathrm{K}^{+}` voltage-dependent ion
982+ currents :math:`\left(I_{\mathrm{Na}}\right.` and :math:`I_{\mathrm{K}}` ) are of the
983+ Hodgkin-Huxley type (Hodgkin and Huxley, 1952). The transient sodium current
984+ :math:`I_{\mathrm{Na}}=g_{\mathrm{Na}} m_{\infty}^{3} h\left(V-E_{\mathrm{Na}}\right)`,
985+ where the activation variable :math:`m` is assumed fast and substituted by its steady-state
986+ function :math:`m_{\infty}=\alpha_{m} /\left(\alpha_{m}+\beta_{m}\right)` ;
987+ :math:`\alpha_{m}(V)=-0.1(V+35) /(\exp (-0.1(V+35))-1), \beta_{m}(V)=4 \exp (-(V+60) / 18)`.
988+ The inactivation variable :math:`h` obeys a first-order kinetics:
989+
990+ .. math::
991+
992+ \frac{d h}{d t}=\phi\left(\alpha_{h}(1-h)-\beta_{h} h\right)
993+
994+ where :math:`\alpha_{h}(V)=0.07 \exp (-(V+58) / 20)` and
995+ :math:`\beta_{h}(V)=1 /(\exp (-0.1(V+28)) +1) \cdot g_{\mathrm{Na}}=35 \mathrm{mS} / \mathrm{cm}^{2}` ;
996+ :math:`E_{\mathrm{Na}}=55 \mathrm{mV}, \phi=5 .`
997+
998+ The delayed rectifier :math:`I_{\mathrm{K}}=g_{\mathrm{K}} n^{4}\left(V-E_{\mathrm{K}}\right)`,
999+ where the activation variable :math:`n` obeys the following equation:
1000+
1001+ .. math::
1002+
1003+ \frac{d n}{d t}=\phi\left(\alpha_{n}(1-n)-\beta_{n} n\right)
1004+
1005+ with :math:`\alpha_{n}(V)=-0.01(V+34) /(\exp (-0.1(V+34))-1)` and
1006+ :math:`\beta_{n}(V)=0.125\exp (-(V+44) / 80)` ; :math:`g_{\mathrm{K}}=9 \mathrm{mS} / \mathrm{cm}^{2}`, and
1007+ :math:`E_{\mathrm{K}}=-90 \mathrm{mV}`.
1008+
1009+
1010+ Parameters
1011+ ----------
1012+ size: sequence of int, int
1013+ The size of the neuron group.
1014+ ENa: float, ArrayType, Initializer, callable
1015+ The reversal potential of sodium. Default is 50 mV.
1016+ gNa: float, ArrayType, Initializer, callable
1017+ The maximum conductance of sodium channel. Default is 120 msiemens.
1018+ EK: float, ArrayType, Initializer, callable
1019+ The reversal potential of potassium. Default is -77 mV.
1020+ gK: float, ArrayType, Initializer, callable
1021+ The maximum conductance of potassium channel. Default is 36 msiemens.
1022+ EL: float, ArrayType, Initializer, callable
1023+ The reversal potential of learky channel. Default is -54.387 mV.
1024+ gL: float, ArrayType, Initializer, callable
1025+ The conductance of learky channel. Default is 0.03 msiemens.
1026+ V_th: float, ArrayType, Initializer, callable
1027+ The threshold of the membrane spike. Default is 20 mV.
1028+ C: float, ArrayType, Initializer, callable
1029+ The membrane capacitance. Default is 1 ufarad.
1030+ phi: float, ArrayType, Initializer, callable
1031+ The temperature regulator constant.
1032+ V_initializer: ArrayType, Initializer, callable
1033+ The initializer of membrane potential.
1034+ h_initializer: ArrayType, Initializer, callable
1035+ The initializer of h channel.
1036+ n_initializer: ArrayType, Initializer, callable
1037+ The initializer of n channel.
1038+ method: str
1039+ The numerical integration method.
1040+ name: str
1041+ The group name.
1042+
1043+ References
1044+ ----------
1045+ .. [9] Wang, X.J. and Buzsaki, G., (1996) Gamma oscillation by synaptic
1046+ inhibition in a hippocampal interneuronal network model. Journal of
1047+ neuroscience, 16(20), pp.6402-6413.
1048+
1049+ """
7251050 def m_inf (self , V ):
7261051 alpha = - 0.1 * (V + 35 ) / (bm .exp (- 0.1 * (V + 35 )) - 1 )
7271052 beta = 4. * bm .exp (- (V + 60. ) / 18. )
0 commit comments