diff --git a/python/swiftest/swiftest/simulation_class.py b/python/swiftest/swiftest/simulation_class.py index 436cfb605..3ccea2d6a 100644 --- a/python/swiftest/swiftest/simulation_class.py +++ b/python/swiftest/swiftest/simulation_class.py @@ -377,14 +377,16 @@ def _run_swiftest_driver(self): env=env, universal_newlines=True) as p: process_output = False - noutput = int((self.param['TSTOP'] - self.param['T0']) / (self.param['DT'] * self.param['ISTEP_OUT'])) - for line in tqdm(p.stdout,total=noutput): + noutput = int((self.param['TSTOP'] - self.param['T0']) / self.param['DT']) + pbar = tqdm(total=noutput) + for line in p.stdout: if "SWIFTEST STOP" in line: process_output = False if process_output: kvstream=line.replace('\n','').strip().split(';') # Removes the newline character, output_data = {kv.split()[0]: kv.split()[1] for kv in kvstream[:-1]} + pbar.update(self.param['ISTEP_OUT']) if "SWIFTEST START" in line: process_output = True @@ -397,6 +399,7 @@ def _run_swiftest_driver(self): except: warnings.warn(f"Error executing main swiftest_driver program", stacklevel=2) + pbar.close() return def run(self,**kwargs):