From 340fcd61b9287c00dfdcf62abe3a525e2b7a86f8 Mon Sep 17 00:00:00 2001 From: Lucas Koelman Date: Thu, 8 Nov 2018 11:29:36 +0000 Subject: [PATCH 1/2] Bugfix: past spikes were not cleared in NEURON VectorSpikeSource --- pyNN/neuron/cells.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyNN/neuron/cells.py b/pyNN/neuron/cells.py index cc2d55ed5..118fb92ed 100644 --- a/pyNN/neuron/cells.py +++ b/pyNN/neuron/cells.py @@ -607,5 +607,5 @@ def clear_past_spikes(self): end = self._spike_times.indwhere(">", h.t) if end > 0: self._spike_times.remove(0, end - 1) # range is inclusive - - + else: + self._spike_times.resize(0) From 48d608b3434aba9e8371de29447cbf36fd2b3bdb Mon Sep 17 00:00:00 2001 From: Lucas Koelman Date: Sun, 2 Dec 2018 10:59:39 +0000 Subject: [PATCH 2/2] Fix bug in VectorSpikeSource for NEURON backend. Upon calling clear_past_spikes() the spike vector was resized, but readout of those spike times by the VecStim mechanism was not re-initialized. This caused the indexing calculation in VecStim to go wrong resulting in erroneous spike timings. --- pyNN/neuron/cells.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyNN/neuron/cells.py b/pyNN/neuron/cells.py index 118fb92ed..d5ab53e43 100644 --- a/pyNN/neuron/cells.py +++ b/pyNN/neuron/cells.py @@ -609,3 +609,5 @@ def clear_past_spikes(self): self._spike_times.remove(0, end - 1) # range is inclusive else: self._spike_times.resize(0) + # Vector is resized -> restart VecStim.play() to fix indexing + self.play(self._spike_times)