Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions brainpy/dyn/neurons/reduced_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LIF(NeuGroup):

.. math::

\tau \frac{dV}{dt} = - (V(t) - V_{rest}) + I(t) \\
\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}

Expand All @@ -56,6 +56,8 @@ class LIF(NeuGroup):
Reset potential after spike.
V_th: float, JaxArray, ndarray, Initializer, callable
Threshold potential of spike.
R: float, JaxArray, ndarray, Initializer, callable
Membrane resistance.
tau: float, JaxArray, ndarray, Initializer, callable
Membrane time constant.
tau_ref: float, JaxArray, ndarray, Initializer, callable
Expand Down Expand Up @@ -84,6 +86,7 @@ def __init__(
V_rest: Union[float, Tensor, Initializer, Callable] = 0.,
V_reset: Union[float, Tensor, Initializer, Callable] = -5.,
V_th: Union[float, Tensor, Initializer, Callable] = 20.,
R: Union[float, Tensor, Initializer, Callable] = 1.,
tau: Union[float, Tensor, Initializer, Callable] = 10.,
tau_ref: Union[float, Tensor, Initializer, Callable] = 1.,
V_initializer: Union[Initializer, Callable, Tensor] = ZeroInit(),
Expand All @@ -103,6 +106,7 @@ def __init__(
self.V_rest = init_param(V_rest, size, allow_none=False)
self.V_reset = init_param(V_reset, size, allow_none=False)
self.V_th = init_param(V_th, size, allow_none=False)
self.R = init_param(R, size, allow_none=False)
self.tau = init_param(tau, size, allow_none=False)
self.tau_ref = init_param(tau_ref, size, allow_none=False)
if noise_type not in ['func', 'value']:
Expand All @@ -121,7 +125,7 @@ def __init__(
self.refractory = bm.Variable(bm.zeros(size, dtype=bool))

# integral
f = lambda V, t, I_ext: (-V + self.V_rest + I_ext) / self.tau
f = lambda V, t, I_ext: (-V + self.V_rest + self.R * I_ext) / self.tau
if self.noise is not None:
g = noise if (noise_type == 'func') else (lambda V, t, I_ext: self.noise / bm.sqrt(self.tau))
self.integral = sdeint(method=method, f=f, g=g)
Expand Down