@@ -22,7 +22,7 @@ class Trellis:
2222 Number of memory elements per input of the convolutional encoder.
2323 g_matrix : 2D ndarray of ints (octal representation)
2424 Generator matrix G(D) of the convolutional encoder. Each element of
25- G(D) represents a polynomial.
25+ G(D) represents a polynomial.
2626 feedback : int, optional
2727 Feedback polynomial of the convolutional encoder. Default value is 00.
2828 code_type : {'default', 'rsc'}, optional
@@ -263,7 +263,7 @@ def visualize(self, trellis_length = 2, state_order = None,
263263 plt .savefig ('trellis' )
264264
265265
266- def conv_encode (message_bits , trellis , termination = 'cont ' , puncture_matrix = None ):
266+ def conv_encode (message_bits , trellis , termination = 'term ' , puncture_matrix = None ):
267267 """
268268 Encode bits using a convolutional code.
269269 Parameters
@@ -293,7 +293,11 @@ def conv_encode(message_bits, trellis, termination = 'cont', puncture_matrix=Non
293293
294294 number_message_bits = np .size (message_bits )
295295
296- if termination == 'term' :
296+ if termination == 'cont' :
297+ inbits = message_bits
298+ number_inbits = number_message_bits
299+ number_outbits = int (number_inbits / rate )
300+ else :
297301 # Initialize an array to contain the message bits plus the truncation zeros
298302 if code_type == 'rsc' :
299303 inbits = message_bits
@@ -305,10 +309,7 @@ def conv_encode(message_bits, trellis, termination = 'cont', puncture_matrix=Non
305309 # Pad the input bits with M zeros (L-th terminated truncation)
306310 inbits [0 :number_message_bits ] = message_bits
307311 number_outbits = int (number_inbits / rate )
308- else :
309- inbits = message_bits
310- number_inbits = number_message_bits
311- number_outbits = int (number_inbits / rate )
312+
312313
313314
314315
0 commit comments