forked from nest/nestml
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add timestep() predefined function akin to resolution()
- Loading branch information
C.A.P. Linssen
committed
Sep 22, 2024
1 parent
2d5e24d
commit 5461579
Showing
2 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
""" | ||
iaf_psc_delta_fixed_timestep - Current-based leaky integrate-and-fire neuron model with delta-kernel post-synaptic currents | ||
########################################################################################################################### | ||
|
||
Description | ||
+++++++++++ | ||
|
||
iaf_psc_delta is an implementation of a leaky integrate-and-fire model | ||
where the potential jumps on each spike arrival. | ||
|
||
The threshold crossing is followed by an absolute refractory period | ||
during which the membrane potential is clamped to the resting potential. | ||
|
||
Spikes arriving while the neuron is refractory, are discarded by | ||
default. If the property ``with_refr_input`` is set to true, such | ||
spikes are added to the membrane potential at the end of the | ||
refractory period, dampened according to the interval between | ||
arrival and end of refractoriness. | ||
|
||
The general framework for the consistent formulation of systems with | ||
neuron like dynamics interacting by point events is described in | ||
[1]_. A flow chart can be found in [2]_. | ||
|
||
This model differs from ``iaf_psc_delta_fixed_timestep`` in that it | ||
assumes a fixed-timestep simulator, so the function ``resolution()`` | ||
can be used. | ||
|
||
|
||
References | ||
++++++++++ | ||
|
||
.. [1] Rotter S, Diesmann M (1999). Exact simulation of | ||
time-invariant linear systems with applications to neuronal | ||
modeling. Biologial Cybernetics 81:381-402. | ||
DOI: https://doi.org/10.1007/s004220050570 | ||
.. [2] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001). State | ||
space analysis of synchronous spiking in cortical neural | ||
networks. Neurocomputing 38-40:565-571. | ||
DOI: https://doi.org/10.1016/S0925-2312(01)00409-X | ||
|
||
|
||
See also | ||
++++++++ | ||
|
||
iaf_psc_alpha, iaf_psc_exp | ||
""" | ||
model iaf_psc_delta_fixed_timestep_neuron: | ||
state: | ||
V_m mV = E_L # Membrane potential | ||
refr_t ms = 0 ms # Refractory period timer | ||
is_refractory boolean = false | ||
|
||
equations: | ||
kernel K_delta = delta(t) | ||
V_m' = -(V_m - E_L) / tau_m + convolve(K_delta, spikes) * (mV / ms) + (I_e + I_stim) / C_m | ||
|
||
parameters: | ||
tau_m ms = 10 ms # Membrane time constant | ||
C_m pF = 250 pF # Capacity of the membrane | ||
refr_T ms = 2 ms # Duration of refractory period | ||
tau_syn ms = 2 ms # Time constant of synaptic current | ||
E_L mV = -70 mV # Resting membrane potential | ||
V_reset mV = -70 mV # Reset potential of the membrane | ||
V_th mV = -55 mV # Spike threshold | ||
V_min mV = -inf * 1 mV # Absolute lower value for the membrane potential | ||
|
||
# constant external input current | ||
I_e pA = 0 pA | ||
|
||
input: | ||
spikes <- spike | ||
I_stim pA <- continuous | ||
|
||
output: | ||
spike | ||
|
||
update: | ||
if is_refractory: | ||
# neuron is absolute refractory, do not evolve V_m | ||
refr_t -= resolution() | ||
else: | ||
# neuron not refractory, so evolve all ODEs (including V_m) | ||
integrate_odes() | ||
|
||
onCondition(not is_refractory and V_m >= V_th): | ||
# threshold crossing | ||
V_m = V_reset | ||
|
||
if refr_T > 0 ms: | ||
refr_t = refr_T # start of the refractory period | ||
is_refractory = true | ||
|
||
emit_spike() | ||
|
||
onCondition(is_refractory and refr_t <= resolution() / 2): | ||
# end of refractory period | ||
refr_t = 0 ms | ||
is_refractory = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters