LifRefLTC#
- class brainpy.dyn.LifRefLTC(size, sharding=None, keep_size=False, mode=None, spk_fun=InvSquareGrad(alpha=100.0), spk_dtype=None, detach_spk=False, spk_reset='soft', method='exp_auto', name=None, init_var=True, scaling=None, V_rest=0.0, V_reset=-5.0, V_th=20.0, R=1.0, tau=10.0, V_initializer=ZeroInit, tau_ref=0.0, ref_var=False, noise=None)[source]#
Leaky integrate-and-fire neuron model with liquid time-constant which has refractory periods .
The formal equations of a LIF model [1] is given by:
\[\begin{split}\tau \frac{dV}{dt} = - (V(t) - V_{rest}) + RI(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.
Examples
There is an example usage:
import brainpy as bp neu = bp.dyn.LifRefLTC(1, ) # example for section input inputs = bp.inputs.section_input([0., 21., 0.], [100., 300., 100.]) runner = bp.DSRunner(neu, monitors=['V']) runner.run(inputs=inputs) bp.visualize.line_plot(runner.mon['ts'], runner.mon['V'], show=True)
- Parameters:
V_rest (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Resting membrane potential.V_reset (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Reset potential after spike.V_th (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Threshold potential of spike.R (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Membrane resistance.tau (
Union
[float
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
),Callable
]) – float, ArrayType, callable. Membrane time constant.V_initializer (
Union
[Callable
,TypeVar
(ArrayType
,Array
,Variable
,TrainVar
,Array
,ndarray
)]) – ArrayType, callable. The initializer of membrane potential.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
.