HH#
- class brainpy.state.HH(in_size, ENa=Quantity(50., "mV"), gNa=Quantity(120., "mS"), EK=Quantity(-77., "mV"), gK=Quantity(36., "mS"), EL=Quantity(-54.387, "mV"), gL=Quantity(0.03, "mS"), V_th=Quantity(20., "mV"), C=Quantity(1., "uF"), V_initializer=Uniform(low=-70. mV, high=-60. mV), m_initializer=None, h_initializer=None, n_initializer=None, spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='soft', name=None)#
Hodgkin–Huxley neuron model.
Model Descriptions
The Hodgkin-Huxley (HH; Hodgkin & Huxley, 1952) model 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,
\[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 \{m, h, n\}\]where
\[\alpha_m(V) = \frac{0.1(V+40)}{1-\exp\!\left(\frac{-(V + 40)}{10}\right)}\]\[\beta_m(V) = 4.0 \exp\!\left(\frac{-(V + 65)}{18}\right)\]\[\alpha_h(V) = 0.07 \exp\!\left(\frac{-(V+65)}{20}\right)\]\[\beta_h(V) = \frac{1}{1 + \exp\!\left(\frac{-(V + 35)}{10}\right)}\]\[\alpha_n(V) = \frac{0.01(V+55)}{1-\exp(-(V+55)/10)}\]\[\beta_n(V) = 0.125 \exp\!\left(\frac{-(V + 65)}{80}\right)\]- Parameters:
in_size (
Size) – Size of the input to the neuron.ENa (
ArrayLike, default50. * u.mV) – Reversal potential of sodium.gNa (
ArrayLike, default120. * u.msiemens) – Maximum conductance of sodium channel.EK (
ArrayLike, default-77. * u.mV) – Reversal potential of potassium.gK (
ArrayLike, default36. * u.msiemens) – Maximum conductance of potassium channel.EL (
ArrayLike, default-54.387 * u.mV) – Reversal potential of leak channel.gL (
ArrayLike, default0.03 * u.msiemens) – Conductance of leak channel.V_th (
ArrayLike, default20. * u.mV) – Threshold of the membrane spike.C (
ArrayLike, default1.0 * u.ufarad) – Membrane capacitance.V_initializer (
Callable) – Initializer for membrane potential.m_initializer (
Callable, optional) – Initializer for m channel. If None, uses steady state.h_initializer (
Callable, optional) – Initializer for h channel. If None, uses steady state.n_initializer (
Callable, optional) – Initializer for n channel. If None, uses steady state.spk_fun (
Callable, defaultsurrogate.ReluGrad()) – Surrogate gradient function.spk_reset (
str, default'soft') – Reset mechanism after spike generation.name (
str, optional) – Name of the neuron layer.
- V#
Membrane potential.
- Type:
HiddenState
- m#
Sodium activation variable.
- Type:
HiddenState
- h#
Sodium inactivation variable.
- Type:
HiddenState
- n#
Potassium activation variable.
- Type:
HiddenState
See also
MorrisLecarTwo-dimensional reduced excitation model.
WangBuzsakiHHModified HH model for hippocampal interneurons.
Notes
The Hodgkin-Huxley model is the foundation of biophysical neuron modeling [1].
This implementation uses exponential Euler integration for numerical stability.
For more information about the model, see [2].
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> # Create an HH neuron layer with 10 neurons >>> hh = brainpy.state.HH(10) >>> # Initialize the state >>> hh.init_state(batch_size=1) >>> # Apply an input current and update the neuron state >>> spikes = hh.update(x=10.*u.uA)
- get_spike(V=None)[source]#
Generate spikes based on neuron state variables.
This abstract method must be implemented by subclasses to define the spike generation mechanism. The method should use the surrogate gradient function
self.spk_funto enable gradient-based learning.- Parameters:
*args – Positional arguments (typically state variables like membrane potential)
**kwargs – Keyword arguments
- Returns:
Binary spike tensor where 1 indicates a spike and 0 indicates no spike.
- Return type:
ArrayLike- Raises:
NotImplementedError – If the subclass does not implement this method.