From a562493cd1d6a179e31a7256f897c0e0a50f587c Mon Sep 17 00:00:00 2001 From: Robin De Schepper Date: Thu, 25 Jan 2024 11:56:29 +0100 Subject: [PATCH] updated naming and api of AdapterProgress --- bsb/simulation/adapter.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bsb/simulation/adapter.py b/bsb/simulation/adapter.py index 3269d2ab8..256ee839b 100644 --- a/bsb/simulation/adapter.py +++ b/bsb/simulation/adapter.py @@ -17,26 +17,26 @@ class AdapterProgress: def __init__(self, duration): - self._progdur = duration - self._progstart = self._last_progtic = time() - self._progtics = 0 + self._duration = duration + self._start = self._last_tick = time() + self._ticks = 0 def tick(self, step): """ Report simulation progress. """ now = time() - tic = now - self._last_progtic - self._progtics += 1 - el = now - self._progstart + tic = now - self._last_tick + self._ticks += 1 + el = now - self._start progress = types.SimpleNamespace( - progression=step, duration=self._progdur, time=time(), tick=tic, elapsed=el + progression=step, duration=self._duration, time=time(), tick=tic, elapsed=el ) - self._last_progtic = now + self._last_tick = now return progress - def steps(self, duration, step=1): - steps = itertools.chain(np.arange(0, duration), (duration,)) + def steps(self, step=1): + steps = itertools.chain(np.arange(0, self._duration, step), (self._duration,)) a, b = itertools.tee(steps) next(b, None) yield from zip(a, b)