diff --git a/sw/utility/simulation.py b/sw/utility/simulation.py index 6f64d57..d27605f 100644 --- a/sw/utility/simulation.py +++ b/sw/utility/simulation.py @@ -90,7 +90,7 @@ class Simulator: "the universe and everything", leave=False, bar_format="{l_bar}{bar}| {n_fmt}/{" - "total_fmt}") + "total_fmt} [{elapsed}]") decoder = self._decoders[self._curr_decoder_index] self._decoder_pbar = tqdm(total=len(self._SNRs), @@ -101,11 +101,10 @@ class Simulator: bar_format="{l_bar}{bar}| {n_fmt}/{" "total_fmt}") - self._snr_pbar = tqdm(total=self._target_frame_errors, + self._snr_pbar = tqdm(total=self._max_num_iterations, desc=f"Simulating for SNR = {self._SNRs[0]} dB", leave=False, - bar_format="{l_bar}{bar}| {n_fmt}/{total_fmt} " - "[{elapsed}<{remaining}]") + ) def __getstate__(self) -> typing.Dict: """Custom serialization function called by the 'pickle' module @@ -161,13 +160,12 @@ class Simulator: last transmission """ self._curr_num_iterations += 1 + self._snr_pbar.update(1) if bit_errors > 0: self._curr_num_frame_errors += 1 self._curr_num_bit_errors += bit_errors - self._snr_pbar.update(1) - def _advance_state(self) -> None: """Advance the state of the simulator. @@ -199,6 +197,7 @@ class Simulator: self._curr_SNRs_index += 1 self._snr_pbar.reset() + self._overall_pbar.refresh() self._snr_pbar.set_description( f"Simulating for SNR = " f"{self._SNRs[self._curr_SNRs_index]} dB")