diff --git a/slic/core/acquisition/broker_client.py b/slic/core/acquisition/broker_client.py index ec5efffe9..e3ec6aeda 100644 --- a/slic/core/acquisition/broker_client.py +++ b/slic/core/acquisition/broker_client.py @@ -36,14 +36,14 @@ class BrokerClient: self.running = True - with tqdm(total=n_pulses) as pbar: + with stqdm(total=n_pulses) as pbar: while self.running: current_pulseid = get_current_pulseid() if current_pulseid > stop_pulseid: break sleep(self.wait_time) - delta_n = 1 + ((current_pulseid - start_pulseid) // rate_multiplicator) - pbar.n # +1 to start at 0 (otherwise starts at -1) - pbar.update(delta_n) + delta_n = (current_pulseid - start_pulseid) // rate_multiplicator + pbar.set(delta_n) self.running = False @@ -170,3 +170,14 @@ def aligned_pids(start, n, rm): +class stqdm(tqdm): + + def set(self, elapsed): + """ + update with elapsed n, i.e., the delta between start and current n + """ + increment = elapsed + 1 - self.n # +1 to start at 0 (otherwise starts at -1) + self.update(increment) + + +