# brainmodels.neurons.HH

class brainmodels.neurons.HH(size, ENa=50.0, gNa=120.0, EK=- 77.0, gK=36.0, EL=- 54.387, gL=0.03, V_th=20.0, C=1.0, method='exponential_euler', **kwargs)[source]

Hodgkin–Huxley neuron model.

Model Descriptions

The Hodgkin-Huxley (HH; Hodgkin & Huxley, 1952) model 1 for the generation of the nerve action potential is one of the most successful mathematical models of a complex biological process that has ever been formulated. The basic concepts expressed in the model have proved a valid approach to the study of bio-electrical activity from the most primitive single-celled organisms such as Paramecium, right through to the neurons within our own brains.

Mathematically, the model is given by,

\begin{align}\begin{aligned}C \frac {dV} {dt} = -(\bar{g}_{Na} m^3 h (V &-E_{Na}) + \bar{g}_K n^4 (V-E_K) + g_{leak} (V - E_{leak})) + I(t)\\\frac {dx} {dt} &= \alpha_x (1-x) - \beta_x, \quad x\in {\rm{\{m, h, n\}}}\\&\alpha_m(V) = \frac {0.1(V+40)}{1-\exp(\frac{-(V + 40)} {10})}\\&\beta_m(V) = 4.0 \exp(\frac{-(V + 65)} {18})\\&\alpha_h(V) = 0.07 \exp(\frac{-(V+65)}{20})\\&\beta_h(V) = \frac 1 {1 + \exp(\frac{-(V + 35)} {10})}\\&\alpha_n(V) = \frac {0.01(V+55)}{1-\exp(-(V+55)/10)}\\&\beta_n(V) = 0.125 \exp(\frac{-(V + 65)} {80})\end{aligned}\end{align}

The illustrated example of HH neuron model please see this notebook.

The Hodgkin–Huxley model can be thought of as a differential equation system with four state variables, $$V_{m}(t),n(t),m(t)$$, and $$h(t)$$, that change with respect to time $$t$$. The system is difficult to study because it is a nonlinear system and cannot be solved analytically. However, there are many numeric methods available to analyze the system. Certain properties and general behaviors, such as limit cycles, can be proven to exist.

1. Center manifold

Because there are four state variables, visualizing the path in phase space can be difficult. Usually two variables are chosen, voltage $$V_{m}(t)$$ and the potassium gating variable $$n(t)$$, allowing one to visualize the limit cycle. However, one must be careful because this is an ad-hoc method of visualizing the 4-dimensional system. This does not prove the existence of the limit cycle. A better projection can be constructed from a careful analysis of the Jacobian of the system, evaluated at the equilibrium point. Specifically, the eigenvalues of the Jacobian are indicative of the center manifold’s existence. Likewise, the eigenvectors of the Jacobian reveal the center manifold’s orientation. The Hodgkin–Huxley model has two negative eigenvalues and two complex eigenvalues with slightly positive real parts. The eigenvectors associated with the two negative eigenvalues will reduce to zero as time $$t$$ increases. The remaining two complex eigenvectors define the center manifold. In other words, the 4-dimensional system collapses onto a 2-dimensional plane. Any solution starting off the center manifold will decay towards the center manifold. Furthermore, the limit cycle is contained on the center manifold.

2. Bifurcations

If the injected current $$I$$ were used as a bifurcation parameter, then the Hodgkin–Huxley model undergoes a Hopf bifurcation. As with most neuronal models, increasing the injected current will increase the firing rate of the neuron. One consequence of the Hopf bifurcation is that there is a minimum firing rate. This means that either the neuron is not firing at all (corresponding to zero frequency), or firing at the minimum firing rate. Because of the all-or-none principle, there is no smooth increase in action potential amplitude, but rather there is a sudden “jump” in amplitude. The resulting transition is known as a canard. The following image shows the bifurcation diagram of the Hodgkin–Huxley model as a function of the external drive $$I$$ 3. The green lines show the amplitude of a stable limit cycle and the blue lines indicate unstable limit-cycle behaviour, both born from Hopf bifurcations. The solid red line shows the stable fixed point and the black line shows the unstable fixed point. Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>> group = bp.math.jit(brainmodels.neurons.HH(2, monitors=['V']))
>>> group.run(200., inputs=('input', 10.), report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, show=True)
>>> group.run(200., report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, show=True)

>>> import brainpy as bp
>>> import brainmodels
>>> group = bp.math.jit(brainmodels.neurons.HH(2, monitors=bp.Monitor(variables=['V'], intervals=[1.])))
>>> group.run(200., inputs=('input', 10.), report=0.1)
>>> bp.visualize.line_plot(group.mon['V.t'], group.mon.V, show=True)

>>> import brainpy as bp
>>> import brainmodels
>>> import matplotlib.pyplot as plt
>>>
>>> group = bp.math.jit(brainmodels.neurons.HH(2, monitors=['V']))
>>> I1 = bp.inputs.spike_input(sp_times=[500., 550., 1000, 1030, 1060, 1100, 1200], sp_lens=5, sp_sizes=5., duration=2000, )
>>> I2 = bp.inputs.spike_input(sp_times=[600.,       900, 950, 1500], sp_lens=5, sp_sizes=5., duration=2000, )
>>> I1 += bp.math.random.normal(0, 3, size=I1.shape)
>>> I2 += bp.math.random.normal(0, 3, size=I2.shape)
>>> I = bp.math.stack((I1, I2), axis=-1)
>>> group.run(2000., inputs=('input', I, 'iter'), report=0.1)
>>>
>>> fig, gs = bp.visualize.get_figure(1, 1, 3, 8)
>>> plt.plot(group.mon.ts, group.mon.V[:, 0])
>>> plt.plot(group.mon.ts, group.mon.V[:, 1] + 130)
>>> plt.xlim(10, 2000)
>>> plt.xticks([])
>>> plt.yticks([])
>>> plt.show()


Model Parameters

 Parameter Init Value Unit Explanation V_th mV the spike threshold. C ufarad capacitance. E_Na mV reversal potential of sodium. E_K -77. mV reversal potential of potassium. E_leak 54.387 mV reversal potential of unspecific. g_Na msiemens conductance of sodium channel. g_K msiemens conductance of potassium channel. g_leak .03 msiemens conductance of unspecific channels.

Model Variables

 Variables name Initial Value Explanation V -65 Membrane potential. m 0.05 gating variable of the sodium ion channel. n 0.32 gating variable of the potassium ion channel. h 0.60 gating variable of the sodium ion channel. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. t_last_spike -1e7 Last spike time stamp.

References

1

Hodgkin, Alan L., and Andrew F. Huxley. “A quantitative description of membrane current and its application to conduction and excitation in nerve.” The Journal of physiology 117.4 (1952): 500.

2

https://en.wikipedia.org/wiki/Hodgkin%E2%80%93Huxley_model

3

Ashwin, Peter, Stephen Coombes, and Rachel Nicks. “Mathematical frameworks for oscillatory network dynamics in neuroscience.” The Journal of Mathematical Neuroscience 6, no. 1 (2016): 1-92.

__init__(size, ENa=50.0, gNa=120.0, EK=- 77.0, gK=36.0, EL=- 54.387, gL=0.03, V_th=20.0, C=1.0, method='exponential_euler', **kwargs)[source]

Methods

 __init__(size[, ENa, gNa, EK, gK, EL, gL, ...]) build_inputs([inputs, show_code]) build_monitors([show_code]) cpu() cuda() derivative(V, m, h, n, t, Iext) ints([method]) Collect all integrators in this node and the children nodes. load_states(filename[, verbose, check]) Load the model states. nodes([method, _paths]) Collect all children nodes. register_constant_delay(key, size, delay[, ...]) Register a constant delay. run(duration[, dt, report, inputs, extra_func]) The running function. save_states(filename[, all_vars]) Save the model states. step(t_and_dt, **kwargs) to(devices) tpu() train_vars([method]) The shortcut for retrieving all trainable variables. unique_name([name, type]) Get the unique name for this object. update(_t, _dt) The function to specify the updating rule. vars([method]) Collect all variables in this node and the children nodes.

Attributes

 implicit_nodes Used to wrap the implicit children nodes which cannot be accessed by self.xxx implicit_vars Used to wrap the implicit variables which cannot be accessed by self.xxx target_backend Used to specify the target backend which the model to run.