GifRef#
- class brainpy.dyn.GifRef(size, sharding=None, keep_size=False, mode=None, spk_fun=InvSquareGrad(alpha=100.0), spk_dtype=None, spk_reset='soft', detach_spk=False, method='exp_auto', name=None, init_var=True, scaling=None, 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, V_initializer=OneInit(value=-70.0), I1_initializer=ZeroInit, I2_initializer=ZeroInit, Vth_initializer=OneInit(value=-50.0), tau_ref=0.0, ref_var=False)[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.
References
Examples
There is a simple usage:
import brainpy as bp import matplotlib.pyplot as plt # Tonic Bursting neu = bp.dyn.GifRef(1, a=0.005, A1=10., A2=-0.6) neu.V_th[:] = -50. inputs = bp.inputs.section_input((1.5, 1.7,), (100, 400)) runner = bp.DSRunner(neu, monitors=['V', 'V_th']) runner.run(inputs=inputs) ts = runner.mon.ts fig, gs = bp.visualize.get_figure(1, 1, 4, 8) ax1 = fig.add_subplot(gs[0, 0]) ax1.plot(ts, runner.mon.V[:, 0], label='V') ax1.plot(ts, runner.mon.V_th[:, 0], label='V_th') plt.show()
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.
- Parameters:
size (
TypeVar
(Shape
,int
,Tuple
[int
,...
])) – int, or sequence of int. The neuronal population size.sharding (
Union
[Sequence
[str
],Device
,Sharding
,None
]) – The sharding strategy.keep_size (
bool
) – bool. Keep the neuron group size.spk_fun (
Callable
) – callable. The spike activation function.detach_spk (
bool
) – bool.method (
str
) – str. The numerical integration method.spk_type – The spike data type.
spk_reset (
str
) – The way to reset the membrane potential when the neuron generates spikes. This parameter only works when the computing mode isTrainingMode
. It can besoft
andhard
. Default issoft
.tau_ref (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Refractory period length (ms).has_ref_var – bool. Whether has the refractory variable. Default is
False
.