From ae7fe62713a9d28e28e096456c114ed40b0e4145 Mon Sep 17 00:00:00 2001 From: Renato Naville Watanabe Date: Fri, 14 Mar 2025 14:08:26 -0300 Subject: [PATCH 1/2] end simulation correction when simulation has callbacks --- pyNN/common/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyNN/common/control.py b/pyNN/common/control.py index 4e40ae5d..5d3b8019 100644 --- a/pyNN/common/control.py +++ b/pyNN/common/control.py @@ -79,7 +79,7 @@ def run_until(time_point, callbacks=None): if callbacks: callback_events = [(callback(simulator.state.t), callback) for callback in callbacks] - while simulator.state.t + 1e-9 < time_point: + while simulator.state.t + 1e-9 < time_point - simulator.state.dt / 2.0: callback_events.sort(key=lambda cbe: cbe[0], reverse=True) next, callback = callback_events.pop() # collapse multiple events that happen within the same timestep From 9c80a884233aeddb74b2677188747cfbe1389371 Mon Sep 17 00:00:00 2001 From: Renato Naville Watanabe Date: Wed, 19 Mar 2025 14:05:06 -0300 Subject: [PATCH 2/2] end simulation correction when simulation has callbacks --- pyNN/common/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyNN/common/control.py b/pyNN/common/control.py index 5d3b8019..5541a510 100644 --- a/pyNN/common/control.py +++ b/pyNN/common/control.py @@ -79,7 +79,7 @@ def run_until(time_point, callbacks=None): if callbacks: callback_events = [(callback(simulator.state.t), callback) for callback in callbacks] - while simulator.state.t + 1e-9 < time_point - simulator.state.dt / 2.0: + while simulator.state.t + 1e-9 < time_point - simulator.state.dt: callback_events.sort(key=lambda cbe: cbe[0], reverse=True) next, callback = callback_events.pop() # collapse multiple events that happen within the same timestep