Changed progressbar to show number of iterations istead of frame errors

This commit is contained in:
Andreas Tsouchlos 2022-11-25 10:45:14 +01:00
parent 3777bcba02
commit 516a67795f

View File

@ -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")