diff --git a/sw/utility/simulation.py b/sw/utility/simulation.py index b0b7fe8..84cf7fb 100644 --- a/sw/utility/simulation.py +++ b/sw/utility/simulation.py @@ -221,7 +221,18 @@ class Simulator: [BER_decoder_1, BER_decoder_2, ...] """ SNRs = np.array(self._SNRs) - BERs = [np.array(BER_array) for BER_array in self._BERs] + + # If the BERs of a decoder have not been calculated for all SNRs, + # fill the rest up with zeros to match the length of the 'SNRs' array + BERs = [] + for decoder_BER_list in self._BERs: + padded = np.pad(decoder_BER_list, (0, len(self._SNRs) - len(decoder_BER_list))) + BERs.append(padded) + + # If the BERs have not been calculated for all decoders, fill up the BERs list + # with zero-vectors to match the length of the 'decoders' list + for i in range(len(self._decoders) - len(BERs)): + BERs.append(np.zeros(len(self._SNRs))) return SNRs, BERs