@@ -176,7 +176,7 @@ def square_abs(s):
176176 return P
177177
178178
179- def link_performance (modem , channel , detector , SNRs , send_max , err_min , send_chunck = None , code_rate = 1 ):
179+ def link_performance (modem , channel , detector , SNRs , send_max , err_min , send_chunk = None , code_rate = 1 ):
180180 """
181181 Estimate the BER performance of a link model with Monte Carlo simulation.
182182
@@ -201,13 +201,18 @@ def link_performance(modem, channel, detector, SNRs, send_max, err_min, send_chu
201201 err_min : int
202202 link_performance send bits until it reach err_min errors (see also send_max).
203203
204- send_chunck : int
204+ send_chunk : int
205205 Number of bits to be send at each iteration.
206206 *Default*: send_chunck = err_min
207207
208208 code_rate : float in (0,1]
209209 Rate of the used code.
210210 *Default*: 1 i.e. no code.
211+
212+ Returns
213+ -------
214+ BERs : 1d ndarray
215+ Estimated Bit Error Ratio corresponding to each SNRs
211216 """
212217
213218 # Initialization
@@ -218,11 +223,11 @@ def link_performance(modem, channel, detector, SNRs, send_max, err_min, send_chu
218223 def detector (y , H , constellation ):
219224 return y
220225
221- # Set chunck size and round it to be a multiple of num_bits_symbol*nb_tx to avoid padding
222- if send_chunck is None :
223- send_chunck = err_min
226+ # Set chunk size and round it to be a multiple of num_bits_symbol*nb_tx to avoid padding
227+ if send_chunk is None :
228+ send_chunk = err_min
224229 divider = modem .num_bits_symbol * channel .nb_tx
225- send_chunck = max (divider , send_chunck // divider * divider )
230+ send_chunk = max (divider , send_chunk // divider * divider )
226231
227232 # Computations
228233 for id_SNR in range (len (SNRs )):
@@ -231,7 +236,7 @@ def detector(y, H, constellation):
231236 bit_err = 0
232237 while bit_send < send_max and bit_err < err_min :
233238 # Propagate some bits
234- msg = np .random .choice ((0 , 1 ), send_chunck )
239+ msg = np .random .choice ((0 , 1 ), send_chunk )
235240 symbs = modem .modulate (msg )
236241 channel_output = channel .propagate (symbs )
237242
@@ -248,6 +253,6 @@ def detector(y, H, constellation):
248253 # Count errors
249254 received_msg = modem .demodulate (detected_msg , 'hard' )
250255 bit_err += (msg != received_msg [:len (msg )]).sum () # Remove MIMO padding
251- bit_send += send_chunck
256+ bit_send += send_chunk
252257 BERs [id_SNR ] = bit_err / bit_send
253258 return BERs
0 commit comments