brainmodels.neurons.LIF

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)

(Source code)

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.

__init__(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]

Methods

__init__(size[, V_rest, V_reset, V_th, tau, ...])

build_inputs([inputs, show_code])

build_monitors([show_code])

cpu()

cuda()

derivative(V, 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.