# brainmodels.neurons module

 AdExIF(size[, V_rest, V_reset, V_th, V_T, ...]) Adaptive exponential integrate-and-fire neuron model. AdQuaIF(size[, V_rest, V_reset, V_th, V_c, ...]) Adaptive quadratic integrate-and-fire neuron model. ExpIF(size[, V_rest, V_reset, V_th, V_T, ...]) Exponential integrate-and-fire neuron model. FHN(size[, a, b, tau, Vth, method]) FitzHugh-Nagumo neuron model. GIF(size[, V_rest, V_reset, V_th_inf, ...]) Generalized Integrate-and-Fire model. HH(size[, ENa, gNa, EK, gK, EL, gL, V_th, ...]) Hodgkin–Huxley neuron model. HindmarshRose(size[, a, b, c, d, r, s, ...]) Hindmarsh-Rose neuron model. Izhikevich(size[, a, b, c, d, tau_ref, ...]) The Izhikevich neuron model. LIF(size[, V_rest, V_reset, V_th, tau, ...]) Leaky integrate-and-fire neuron model. MorrisLecar(size[, V_Ca, g_Ca, V_K, g_K, ...]) The Morris-Lecar neuron model. Neuron(size[, method]) QuaIF(size[, V_rest, V_reset, V_th, V_c, c, ...]) Quadratic Integrate-and-Fire neuron model.
class brainmodels.neurons.AdExIF(size, V_rest=- 65.0, V_reset=- 68.0, V_th=- 30.0, V_T=- 59.9, delta_T=3.48, a=1.0, b=1.0, tau=10.0, tau_w=30.0, R=1.0, method='euler', **kwargs)[source]

Model Descriptions

The adaptive exponential integrate-and-fire model, also called AdEx, is a spiking neuron model with two variables [1]_ [2]_.

\begin{split}\begin{aligned} \tau_m\frac{d V}{d t} &= - (V-V_{rest}) + \Delta_T e^{\frac{V-V_T}{\Delta_T}} - Rw + RI(t), \\ \tau_w \frac{d w}{d t} &=a(V-V_{rest}) - w \end{aligned}\end{split}

once the membrane potential reaches the spike threshold,

$\begin{split}V \rightarrow V_{reset}, \\ w \rightarrow w+b.\end{split}$

The first equation describes the dynamics of the membrane potential and includes an activation term with an exponential voltage dependence. Voltage is coupled to a second equation which describes adaptation. Both variables are reset if an action potential has been triggered. The combination of adaptation and exponential voltage dependence gives rise to the name Adaptive Exponential Integrate-and-Fire model.

The adaptive exponential integrate-and-fire model is capable of describing known neuronal firing patterns, e.g., adapting, bursting, delayed spike initiation, initial bursting, fast spiking, and regular spiking.

Model Examples

Model Parameters

 Parameter Init Value Unit Explanation V_rest -65 mV Resting potential. V_reset -68 mV Reset potential after spike. V_th -30 mV Threshold potential of spike and reset. V_T -59.9 mV Threshold potential of generating action potential. delta_T 3.48 Spike slope factor. a 1 The sensitivity of the recovery variable $$u$$ to the sub-threshold fluctuations of the membrane potential $$v$$ b 1 The increment of $$w$$ produced by a spike. R 1 Membrane resistance. tau 10 ms Membrane time constant. Compute by R * C. tau_w 30 ms Time constant of the adaptation current.

Model Variables

 Variables name Initial Value Explanation V 0 Membrane potential. w 0 Adaptation current. 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

Fourcaud-Trocmé, Nicolas, et al. “How spike generation mechanisms determine the neuronal response to fluctuating inputs.” Journal of Neuroscience 23.37 (2003): 11628-11640.

2

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.AdQuaIF(size, V_rest=- 65.0, V_reset=- 68.0, V_th=- 30.0, V_c=- 50.0, a=1.0, b=0.1, c=0.07, tau=10.0, tau_w=10.0, method='euler', **kwargs)[source]

Model Descriptions

\begin{split}\begin{aligned} \tau_m \frac{d V}{d t}&=c(V-V_{rest})(V-V_c) - w + I(t), \\ \tau_w \frac{d w}{d t}&=a(V-V_{rest}) - w, \end{aligned}\end{split}

once the membrane potential reaches the spike threshold,

$\begin{split}V \rightarrow V_{reset}, \\ w \rightarrow w+b.\end{split}$

Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>> group = brainmodels.neurons.AdQuaIF(1, monitors=['V', 'w'])
>>> group.run(300, inputs=('input', 30.))
>>> fig, gs = bp.visualize.get_figure(2, 1, 3, 8)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, ylabel='V')
>>> bp.visualize.line_plot(group.mon.ts, group.mon.w, ylabel='w', show=True)


Model Parameters

 Parameter Init Value Unit Explanation V_rest -65 mV Resting potential. V_reset -68 mV Reset potential after spike. V_th -30 mV Threshold potential of spike and reset. V_c -50 mV Critical voltage for spike initiation. Must be larger than $$V_{rest}$$. a 1 The sensitivity of the recovery variable $$u$$ to the sub-threshold fluctuations of the membrane potential $$v$$ b .1 The increment of $$w$$ produced by a spike. c .07 Coefficient describes membrane potential update. Larger than 0. tau 10 ms Membrane time constant. tau_w 10 ms Time constant of the adaptation current.

Model Variables

 Variables name Initial Value Explanation V 0 Membrane potential. w 0 Adaptation current. 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

Izhikevich, E. M. (2004). Which model to use for cortical spiking neurons?. IEEE transactions on neural networks, 15(5), 1063-1070.

2

Touboul, Jonathan. “Bifurcation analysis of a general class of nonlinear integrate-and-fire neurons.” SIAM Journal on Applied Mathematics 68, no. 4 (2008): 1045-1079.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.ExpIF(size, V_rest=- 65.0, V_reset=- 68.0, V_th=- 30.0, V_T=- 59.9, delta_T=3.48, R=1.0, tau=10.0, tau_ref=1.7, method='euler', **kwargs)[source]

Exponential integrate-and-fire neuron model.

Model Descriptions

In the exponential integrate-and-fire model [1]_, the differential equation for the membrane potential is given by

$\begin{split}\tau\frac{d V}{d t}= - (V-V_{rest}) + \Delta_T e^{\frac{V-V_T}{\Delta_T}} + RI(t), \\ \text{after} \, V(t) \gt V_{th}, V(t) = V_{reset} \, \text{last} \, \tau_{ref} \, \text{ms}\end{split}$

This equation has an exponential nonlinearity with “sharpness” parameter $$\Delta_{T}$$ and “threshold” $$\vartheta_{rh}$$.

The moment when the membrane potential reaches the numerical threshold $$V_{th}$$ defines the firing time $$t^{(f)}$$. After firing, the membrane potential is reset to $$V_{rest}$$ and integration restarts at time $$t^{(f)}+\tau_{\rm ref}$$, where $$\tau_{\rm ref}$$ is an absolute refractory time. If the numerical threshold is chosen sufficiently high, $$V_{th}\gg v+\Delta_T$$, its exact value does not play any role. The reason is that the upswing of the action potential for $$v\gg v +\Delta_{T}$$ is so rapid, that it goes to infinity in an incredibly short time. The threshold $$V_{th}$$ is introduced mainly for numerical convenience. For a formal mathematical analysis of the model, the threshold can be pushed to infinity.

The model was first introduced by Nicolas Fourcaud-Trocmé, David Hansel, Carl van Vreeswijk and Nicolas Brunel [1]_. The exponential nonlinearity was later confirmed by Badel et al. [3]_. It is one of the prominent examples of a precise theoretical prediction in computational neuroscience that was later confirmed by experimental neuroscience.

Two important remarks:

• (i) The right-hand side of the above equation contains a nonlinearity that can be directly extracted from experimental data [3]_. In this sense the exponential nonlinearity is not an arbitrary choice but directly supported by experimental evidence.

• (ii) Even though it is a nonlinear model, it is simple enough to calculate the firing rate for constant input, and the linear response to fluctuations, even in the presence of input noise 4.

Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>> group = brainmodels.neurons.ExpIF(1, monitors=['V'])
>>> group.run(300., inputs=('input', 10.))
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, ylabel='V', show=True)


Model Parameters

 Parameter Init Value Unit Explanation V_rest -65 mV Resting potential. V_reset -68 mV Reset potential after spike. V_th -30 mV Threshold potential of spike. V_T -59.9 mV Threshold potential of generating action potential. delta_T 3.48 Spike slope factor. R 1 Membrane resistance. tau 10 Membrane time constant. Compute by R * C. tau_ref 1.7 Refractory period length.

Model Variables

 Variables name Initial Value Explanation V 0 Membrane potential. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. refractory False Flag to mark whether the neuron is in refractory period. t_last_spike -1e7 Last spike time stamp.

References

1

Fourcaud-Trocmé, Nicolas, et al. “How spike generation mechanisms determine the neuronal response to fluctuating inputs.” Journal of Neuroscience 23.37 (2003): 11628-11640.

2

Gerstner, W., Kistler, W. M., Naud, R., & Paninski, L. (2014). Neuronal dynamics: From single neurons to networks and models of cognition. Cambridge University Press.

3

Badel, Laurent, Sandrine Lefort, Romain Brette, Carl CH Petersen, Wulfram Gerstner, and Magnus JE Richardson. “Dynamic IV curves are reliable predictors of naturalistic pyramidal-neuron voltage traces.” Journal of Neurophysiology 99, no. 2 (2008): 656-666.

4

Richardson, Magnus JE. “Firing-rate response of linear and nonlinear integrate-and-fire neurons to modulated current-based and conductance-based synaptic drive.” Physical Review E 76, no. 2 (2007): 021919.

5

https://en.wikipedia.org/wiki/Exponential_integrate-and-fire

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.FHN(size, a=0.7, b=0.8, tau=12.5, Vth=1.8, method='euler', **kwargs)[source]

FitzHugh-Nagumo neuron model.

Model Descriptions

The FitzHugh–Nagumo model (FHN), named after Richard FitzHugh (1922–2007) who suggested the system in 1961 [1]_ and J. Nagumo et al. who created the equivalent circuit the following year, describes a prototype of an excitable system (e.g., a neuron).

The motivation for the FitzHugh-Nagumo model was to isolate conceptually the essentially mathematical properties of excitation and propagation from the electrochemical properties of sodium and potassium ion flow. The model consists of

• a voltage-like variable having cubic nonlinearity that allows regenerative self-excitation via a positive feedback, and

• a recovery variable having a linear dynamics that provides a slower negative feedback.

\begin{split}\begin{aligned} {\dot {v}} &=v-{\frac {v^{3}}{3}}-w+RI_{\rm {ext}}, \\ \tau {\dot {w}}&=v+a-bw. \end{aligned}\end{split}

The FHN Model is an example of a relaxation oscillator because, if the external stimulus $$I_{\text{ext}}$$ exceeds a certain threshold value, the system will exhibit a characteristic excursion in phase space, before the variables $$v$$ and $$w$$ relax back to their rest values. This behaviour is typical for spike generations (a short, nonlinear elevation of membrane voltage $$v$$, diminished over time by a slower, linear recovery variable $$w$$) in a neuron after stimulation by an external input current.

Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>>
>>> # simulation
>>> fnh = brainmodels.neurons.FHN(1, monitors=['V', 'w'])
>>> fnh.run(100., inputs=('input', 1.), report=0.1)
>>> bp.visualize.line_plot(fnh.mon.ts, fnh.mon.w, legend='w')
>>> bp.visualize.line_plot(fnh.mon.ts, fnh.mon.V, legend='V', show=True)


Model Parameters

 Parameter Init Value Unit Explanation a 1 Positive constant b 1 Positive constant tau 10 ms Membrane time constant. V_th 1.8 mV Threshold potential of spike.

Model Variables

 Variables name Initial Value Explanation V 0 Membrane potential. w 0 A recovery variable which represents the combined effects of sodium channel de-inactivation and potassium channel deactivation. 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

FitzHugh, Richard. “Impulses and physiological states in theoretical models of nerve membrane.” Biophysical journal 1.6 (1961): 445-466.

2

https://en.wikipedia.org/wiki/FitzHugh%E2%80%93Nagumo_model

3

http://www.scholarpedia.org/article/FitzHugh-Nagumo_model

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.GIF(size, V_rest=- 70.0, V_reset=- 70.0, V_th_inf=- 50.0, V_th_reset=- 60.0, R=20.0, tau=20.0, a=0.0, b=0.01, k1=0.2, k2=0.02, R1=0.0, R2=1.0, A1=0.0, A2=0.0, method='exponential_euler', **kwargs)[source]

Generalized Integrate-and-Fire model.

Model Descriptions

The generalized integrate-and-fire model [1]_ is given by

\begin{align}\begin{aligned}&\frac{d I_j}{d t} = - k_j I_j\\&\frac{d V}{d t} = ( - (V - V_{rest}) + R\sum_{j}I_j + RI) / \tau\\&\frac{d V_{th}}{d t} = a(V - V_{rest}) - b(V_{th} - V_{th\infty})\end{aligned}\end{align}

When $$V$$ meet $$V_{th}$$, Generalized IF neuron fires:

\begin{align}\begin{aligned}&I_j \leftarrow R_j I_j + A_j\\&V \leftarrow V_{reset}\\&V_{th} \leftarrow max(V_{th_{reset}}, V_{th})\end{aligned}\end{align}

Note that $$I_j$$ refers to arbitrary number of internal currents.

Model Examples

Model Parameters

 Parameter Init Value Unit Explanation V_rest -70 mV Resting potential. V_reset -70 mV Reset potential after spike. V_th_inf -50 mV Target value of threshold potential $$V_{th}$$ updating. V_th_reset -60 mV Free parameter, should be larger than $$V_{reset}$$. R 20 Membrane resistance. tau 20 ms Membrane time constant. Compute by $$R * C$$. a 0 Coefficient describes the dependence of $$V_{th}$$ on membrane potential. b 0.01 Coefficient describes $$V_{th}$$ update. k1 0.2 Constant pf $$I1$$. k2 0.02 Constant of $$I2$$. R1 0 Free parameter. Describes dependence of $$I_1$$ reset value on $$I_1$$ value before spiking. R2 1 Free parameter. Describes dependence of $$I_2$$ reset value on $$I_2$$ value before spiking. A1 0 Free parameter. A2 0 Free parameter.

Model Variables

 Variables name Initial Value Explanation V -70 Membrane potential. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. V_th -50 Spiking threshold potential. I1 0 Internal current 1. I2 0 Internal current 2. t_last_spike -1e7 Last spike time stamp.

References

1

Mihalaş, Ştefan, and Ernst Niebur. “A generalized linear integrate-and-fire neural model produces diverse spiking behaviors.” Neural computation 21.3 (2009): 704-718.

2

Teeter, Corinne, Ramakrishnan Iyer, Vilas Menon, Nathan Gouwens, David Feng, Jim Berg, Aaron Szafer et al. “Generalized leaky integrate-and-fire models classify multiple neuron types.” Nature communications 9, no. 1 (2018): 1-15.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

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.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.HindmarshRose(size, a=1.0, b=3.0, c=1.0, d=5.0, r=0.01, s=4.0, V_rest=- 1.6, V_th=1.0, method='euler', **kwargs)[source]

Hindmarsh-Rose neuron model.

Model Descriptions

The Hindmarsh–Rose model [1]_ [2]_ of neuronal activity is aimed to study the spiking-bursting behavior of the membrane potential observed in experiments made with a single neuron.

The model has the mathematical form of a system of three nonlinear ordinary differential equations on the dimensionless dynamical variables $$x(t)$$, $$y(t)$$, and $$z(t)$$. They read:

\begin{split}\begin{aligned} \frac{d V}{d t} &= y - a V^3 + b V^2 - z + I \\ \frac{d y}{d t} &= c - d V^2 - y \\ \frac{d z}{d t} &= r (s (V - V_{rest}) - z) \end{aligned}\end{split}

where $$a, b, c, d$$ model the working of the fast ion channels, $$I$$ models the slow ion channels.

Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>> import matplotlib.pyplot as plt
>>>
>>> bp.math.set_dt(dt=0.01)
>>> bp.set_default_odeint('rk4')
>>>
>>> types = ['quiescence', 'spiking', 'bursting', 'irregular_spiking', 'irregular_bursting']
>>> bs = bp.math.array([1.0, 3.5, 2.5, 2.95, 2.8])
>>> Is = bp.math.array([2.0, 5.0, 3.0, 3.3, 3.7])
>>>
>>> # define neuron type
>>> group = brainmodels.neurons.HindmarshRose(len(types), b=bs, monitors=['V'])
>>> group = bp.math.jit(group)
>>> group.run(1e3, inputs=['input', Is], report=0.1)
>>>
>>> fig, gs = bp.visualize.get_figure(row_num=3, col_num=2, row_len=3, col_len=5)
>>> for i, mode in enumerate(types):
>>>     fig.add_subplot(gs[i // 2, i % 2])
>>>     plt.plot(group.mon.ts, group.mon.V[:, i])
>>>     plt.title(mode)
>>>     plt.xlabel('Time [ms]')
>>> plt.show()


Model Parameters

 Parameter Init Value Unit Explanation a 1 Model parameter. Fixed to a value best fit neuron activity. b 3 Model parameter. Allows the model to switch between bursting and spiking, controls the spiking frequency. c 1 Model parameter. Fixed to a value best fit neuron activity. d 5 Model parameter. Fixed to a value best fit neuron activity. r 0.01 Model parameter. Controls slow variable z’s variation speed. Governs spiking frequency when spiking, and affects the number of spikes per burst when bursting. s 4 Model parameter. Governs adaption.

Model Variables

 Member name Initial Value Explanation V -1.6 Membrane potential. y -10 Gating variable. z 0 Gating variable. spike False Whether generate the spikes. input 0 External and synaptic input current. t_last_spike -1e7 Last spike time stamp.

References

1

Hindmarsh, James L., and R. M. Rose. “A model of neuronal bursting using three coupled first order differential equations.” Proceedings of the Royal society of London. Series B. Biological sciences 221.1222 (1984): 87-102.

2

Storace, Marco, Daniele Linaro, and Enno de Lange. “The Hindmarsh–Rose neuron model: bifurcation analysis and piecewise-linear approximations.” Chaos: An Interdisciplinary Journal of Nonlinear Science 18.3 (2008): 033128.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.Izhikevich(size, a=0.02, b=0.2, c=- 65.0, d=8.0, tau_ref=0.0, V_th=30.0, method='euler', **kwargs)[source]

The Izhikevich neuron model.

Model Descriptions

The dynamics of the Izhikevich neuron model [1]_ [2]_ is given by:

\begin{align}\begin{aligned}\frac{d V}{d t} &= 0.04 V^{2}+5 V+140-u+I\\\frac{d u}{d t} &=a(b V-u)\end{aligned}\end{align}
$\begin{split}\text{if} v \geq 30 \text{mV}, \text{then} \begin{cases} v \leftarrow c \\ u \leftarrow u+d \end{cases}\end{split}$

Model Examples

Model Parameters

 Parameter Init Value Unit Explanation a 0.02 It determines the time scale of the recovery variable $$u$$. b 0.2 It describes the sensitivity of the recovery variable $$u$$ to the sub-threshold fluctuations of the membrane potential $$v$$. c -65 It describes the after-spike reset value of the membrane potential $$v$$ caused by the fast high-threshold $$K^{+}$$ conductance. d 8 It describes after-spike reset of the recovery variable $$u$$ caused by slow high-threshold $$Na^{+}$$ and $$K^{+}$$ conductance. tau_ref 0 ms Refractory period length. [ms] V_th 30 mV The membrane potential threshold.

Model Variables

 Variables name Initial Value Explanation V -65 Membrane potential. u 1 Recovery variable. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. refractory False Flag to mark whether the neuron is in refractory period. t_last_spike -1e7 Last spike time stamp.

References

1

Izhikevich, Eugene M. “Simple model of spiking neurons.” IEEE Transactions on neural networks 14.6 (2003): 1569-1572.

2

Izhikevich, Eugene M. “Which model to use for cortical spiking neurons?.” IEEE transactions on neural networks 15.5 (2004): 1063-1070.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.LIF(size, V_rest=0.0, V_reset=- 5.0, V_th=20.0, tau=10.0, tau_ref=1.0, method='exponential_euler', **kwargs)[source]

Leaky integrate-and-fire neuron model.

Model Descriptions

The formal equations of a LIF model [1]_ is given by:

$\begin{split}\tau \frac{dV}{dt} = - (V(t) - V_{rest}) + I(t) \\ \text{after} \quad V(t) \gt V_{th}, V(t) = V_{reset} \quad \text{last} \quad \tau_{ref} \quad \text{ms}\end{split}$

where $$V$$ is the membrane potential, $$V_{rest}$$ is the resting membrane potential, $$V_{reset}$$ is the reset membrane potential, $$V_{th}$$ is the spike threshold, $$\tau$$ is the time constant, $$\tau_{ref}$$ is the refractory time period, and $$I$$ is the time-variant synaptic inputs.

Model Examples

>>> import brainmodels
>>> import brainpy as bp
>>>
>>> group = bp.math.jit(brainmodels.neurons.LIF(100, monitors=['V']))
>>>
>>> group.run(duration=200., inputs=('input', 26.), report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, legend='0-200 ms')
>>>
>>> group.run(duration=(200, 400.), report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, legend='200-400 ms', show=True)


Model Parameters

 Parameter Init Value Unit Explanation V_rest 0 mV Resting membrane potential. V_reset -5 mV Reset potential after spike. V_th 20 mV Threshold potential of spike. tau 10 ms Membrane time constant. Compute by R * C. tau_ref 5 ms Refractory period length.(ms)

Neuron Variables

 Variables name Initial Value Explanation V 0 Membrane potential. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. refractory False Flag to mark whether the neuron is in refractory period. t_last_spike -1e7 Last spike time stamp.

References

1

Abbott, Larry F. “Lapicque’s introduction of the integrate-and-fire model neuron (1907).” Brain research bulletin 50, no. 5-6 (1999): 303-304.

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.MorrisLecar(size, V_Ca=130.0, g_Ca=4.4, V_K=- 84.0, g_K=8.0, V_leak=- 60.0, g_leak=2.0, C=20.0, V1=- 1.2, V2=18.0, V3=2.0, V4=30.0, phi=0.04, V_th=10.0, method='euler', **kwargs)[source]

The Morris-Lecar neuron model.

Model Descriptions

The Morris-Lecar model [1]_ (Also known as $$I_{Ca}+I_K$$-model) is a two-dimensional “reduced” excitation model applicable to systems having two non-inactivating voltage-sensitive conductances. This model was named after Cathy Morris and Harold Lecar, who derived it in 1981. Because it is two-dimensional, the Morris-Lecar model is one of the favorite conductance-based models in computational neuroscience.

The original form of the model employed an instantaneously responding voltage-sensitive Ca2+ conductance for excitation and a delayed voltage-dependent K+ conductance for recovery. The equations of the model are:

\begin{split}\begin{aligned} C\frac{dV}{dt} =& - g_{Ca} M_{\infty} (V - V_{Ca})- g_{K} W(V - V_{K}) - g_{Leak} (V - V_{Leak}) + I_{ext} \\ \frac{dW}{dt} =& \frac{W_{\infty}(V) - W}{ \tau_W(V)} \end{aligned}\end{split}

Here, $$V$$ is the membrane potential, $$W$$ is the “recovery variable”, which is almost invariably the normalized $$K^+$$-ion conductance, and $$I_{ext}$$ is the applied current stimulus.

Model Examples

>>> import brainpy as bp
>>> import brainmodels
>>>
>>> group = brainmodels.neurons.MorrisLecar(1, monitors=['V', 'W'], method='rk4')
>>> group.run(1000, inputs=('input', 100.), dt=0.05)
>>>
>>> fig, gs = bp.visualize.get_figure(2, 1, 3, 8)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.W, ylabel='W')
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, ylabel='V', show=True)


Model Parameters

 Parameter Init Value Unit Explanation V_Ca 130 mV Equilibrium potentials of Ca+.(mV) g_Ca 4.4 Maximum conductance of corresponding Ca+.(mS/cm2) V_K -84 mV Equilibrium potentials of K+.(mV) g_K 8 Maximum conductance of corresponding K+.(mS/cm2) V_Leak -60 mV Equilibrium potentials of leak current.(mV) g_Leak 2 Maximum conductance of leak current.(mS/cm2) C 20 Membrane capacitance.(uF/cm2) V1 -1.2 Potential at which M_inf = 0.5.(mV) V2 18 Reciprocal of slope of voltage dependence of M_inf.(mV) V3 2 Potential at which W_inf = 0.5.(mV) V4 30 Reciprocal of slope of voltage dependence of W_inf.(mV) phi 0.04 A temperature factor. (1/s) V_th 10 mV The spike threshold.

Model Variables

 Variables name Initial Value Explanation V -20 Membrane potential. W 0.02 Gating variable, refers to the fraction of opened K+ channels. 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

Meier, Stephen R., Jarrett L. Lancaster, and Joseph M. Starobin. “Bursting regimes in a reaction-diffusion system with action potential-dependent equilibrium.” PloS one 10.3 (2015): e0122401.

2

http://www.scholarpedia.org/article/Morris-Lecar_model

3

https://en.wikipedia.org/wiki/Morris%E2%80%93Lecar_model

update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.Neuron(size, method='euler', **kwargs)[source]
update(_t, _dt)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.

class brainmodels.neurons.QuaIF(size, V_rest=- 65.0, V_reset=- 68.0, V_th=- 30.0, V_c=- 50.0, c=0.07, R=1.0, tau=10.0, tau_ref=0.0, method='euler', **kwargs)[source]

Model Descriptions

In contrast to physiologically accurate but computationally expensive neuron models like the Hodgkin–Huxley model, the QIF model [1]_ seeks only to produce action potential-like patterns and ignores subtleties like gating variables, which play an important role in generating action potentials in a real neuron. However, the QIF model is incredibly easy to implement and compute, and relatively straightforward to study and understand, thus has found ubiquitous use in computational neuroscience.

$\tau \frac{d V}{d t}=c(V-V_{rest})(V-V_c) + RI(t)$

where the parameters are taken to be $$c$$ =0.07, and $$V_c = -50 mV$$ (Latham et al., 2000).

Model Examples

>>> import brainmodels
>>> import brainpy as bp
>>>
>>> group = brainmodels.neurons.QuaIF(1, monitors=['V'])
>>>
>>> group.run(duration=200., inputs=('input', 20.), report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, show=True)
>>>
>>> group.run(duration=(200, 400.), report=0.1)
>>> bp.visualize.line_plot(group.mon.ts, group.mon.V, show=True)


Model Parameters

 Parameter Init Value Unit Explanation V_rest -65 mV Resting potential. V_reset -68 mV Reset potential after spike. V_th -30 mV Threshold potential of spike and reset. V_c -50 mV Critical voltage for spike initiation. Must be larger than V_rest. c .07 Coefficient describes membrane potential update. Larger than 0. R 1 Membrane resistance. tau 10 ms Membrane time constant. Compute by R * C. tau_ref 0 ms Refractory period length.

Model Variables

 Variables name Initial Value Explanation V 0 Membrane potential. input 0 External and synaptic input current. spike False Flag to mark whether the neuron is spiking. refractory False Flag to mark whether the neuron is in refractory period. t_last_spike -1e7 Last spike time stamp.

References

1

P. E. Latham, B.J. Richmond, P. Nelson and S. Nirenberg (2000) Intrinsic dynamics in neuronal networks. I. Theory. J. Neurophysiology 83, pp. 808–827.

update(_t, _dt, **kwargs)[source]

The function to specify the updating rule.

Parameters
• _t (float) – The current time.

• _dt (float) – The time step.