Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refractoriness handled incorrectly in corner cases in many neuron models #3309

Open
heplesser opened this issue Sep 10, 2024 · 7 comments
Open
Labels
I: Behavior changes Introduces changes that produce different results for some users S: Normal Handle this with default priority T: Bug Wrong statements in the code or documentation

Comments

@heplesser
Copy link
Contributor

heplesser commented Sep 10, 2024

The refractory time after a spike at time $t^*$ is defined for iaf_psc_delta and many other neurons via

$$V_m(t) = V_{\text{reset}} \quad \text{for} \quad t^* \leq t < t^* + t_{\text{refract}}$$

Note that the membrane potentials is clamped during a left-closed, right-open interval. This means that a neuron with $t_{\text{refract}} = 1$ ms after a spike at $t=2$ ms, shall be able to fire again at $t=3$ ms.

Incorrect behavior for iaf_psc_delta

In the case above, if the iaf_psc_delta neuron receives an input spike at $t=3$ ms, this spike arrives after the end of the refractory time, which ends at $t=3-$ ms, i.e., infinitesimally before the spike arrival. If the weight of the spike is sufficient to carry the membrane potential across threshold, the neuron should therefore spike. This is not the case at present:

nest.ResetKernel()
nest.resolution = 0.1

n = nest.Create('iaf_psc_exp', params={'I_e': 1e9, 't_ref': 1.})
r = nest.Create('spike_recorder')
nest.Connect(n, r)
nest.Simulate(10)
r.events['times']

--> array([3., 5., 7.])   # expected: 3, 4, 5, 6, 7

Counterintuitive (but mathematically correct) behavior for strong input

Consider now a neuron (applies to many NEST models) driven by a very strong I_e current. In the limit $I_e\to\infty$ one would expect the ISI to approach $t_{\text{refract}}$, i.e., in the case above to fire once per second. But membrane potential is clamped to $V_{\text{reset}}$ until time $3-$, i.e., until infinitesimally before the end of the refractory period. As long as $I_e$ is finite (not a delta-pulse as in the case above), we therefore have $V_m = V_{\text{reset}}$ at time 3, and then neuron will not spike. It can at the earliest spike at the end of the next time step. With time step $h$, the shortest possible ISI is thus $t_{\text{refract}}+h$ as demonstrated below. This is an effect of time discretization. If I have calculated correctly, the current required to bring an iaf_psc_delta neuron with default parameters from reset to threshold in a single 0.1 ms time step would be around 38 nA (nano, not pico), corresponding to a membrane potential rise of 150 mV/ms, i.e., this problem would surface only for currents at the limit of biologically plausible values.

It might still be useful to document this behavior somewhere.

nest.ResetKernel()
nest.resolution = 0.1

n = nest.Create('iaf_psc_exp', params={'I_e': 1e9, 't_ref': 1.})
r = nest.Create('spike_recorder')
nest.Connect(n, r)
nest.Simulate(10)
r.events['times']

--> array([ 0.1,  1.2,  2.3,  3.4,  4.5,  5.6,  6.7,  7.8,  8.9, 10. ])    # note the 1.1 ms ISI
@heplesser heplesser added T: Bug Wrong statements in the code or documentation S: Normal Handle this with default priority I: Behavior changes Introduces changes that produce different results for some users labels Sep 10, 2024
@heplesser heplesser added this to Models Sep 10, 2024
@github-project-automation github-project-automation bot moved this to To do in Models Sep 10, 2024
@heplesser
Copy link
Contributor Author

heplesser commented Sep 13, 2024

Actually, it turns out that the documentation of refractoriness in iaf_psc_delta might be wrong. In

Morrison A, Straube S, Plesser HE and Diesmann M (2007)
Exact subthreshold integration with continuous spike times in discrete-time neural network simulations.
MIT Press Neural Computation. Paper Reprint

we described (defined) the refractory mechanism as follows in Sec 3:

If the membrane potential $y^3_{t+h}$ exceeds the threshold value $\Theta$, the neuron communicates a spike event to the network with a time stamp of $t + h$; the membrane potential is subsequently clamped to 0 in the interval $[t + h, t + h + \tau_r]$ (see Figure 1A). The earliest grid point at which a neuron could produce its next spike is therefore $t + 2h + \tau_r$. Note that for a grid- constrained implementation, $\tau_r$ must be an integer multiple of $h$, because the membrane potential is evaluated only at grid points, and we define it to be nonzero.

So there we defined the refactory period as an interval closed on both ends.

@diesmann
Copy link

We will work out a plan to improve the documentation.

@diesmann
Copy link

diesmann commented Sep 13, 2024

The correctness of the implementation of refractoriness is tested in CI by a sequence of tests. These tests originally referred to a single reference model iaf_neuron. However, this neuron model was removed from recent releases of NEST because it was identical to iaf_psc_alpha. It might be that in this process also the respective tests were removed without replacement. Candidates are:

  • test_iaf.sli
  • test_iaf_i0
  • test_iaf_i0_refractory
  • test_iaf_dc

We need to check whether these crucial tests are still active, and if not bring them back.

@tomtetzlaff
Copy link

testsuite/pytests/sli2py_neurons/test_iaf_psc_alpha.py

seems to do what test_iaf.sli did.

Copy link

Issue automatically marked stale!

@github-actions github-actions bot added the stale Automatic marker for inactivity, please have another look here label Nov 13, 2024
@tomtetzlaff
Copy link

@clinssen
Copy link
Contributor

The PR addressing this issue should also update glossary items pertaining to refractoriness.

@github-actions github-actions bot removed the stale Automatic marker for inactivity, please have another look here label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: Behavior changes Introduces changes that produce different results for some users S: Normal Handle this with default priority T: Bug Wrong statements in the code or documentation
Projects
Status: To do
Development

No branches or pull requests

4 participants