CommPy icon indicating copy to clipboard operation
CommPy copied to clipboard

Trying to run turbo_encode

Open sankalpmittal1911-BitSian opened this issue 5 years ago • 2 comments

import numpy as np
import commpy.channelcoding as cx
import commpy.channelcoding.convcode as cc
memory = np.array([2])
g_matrix = np.array([[5, 7]])
trellis = cc.Trellis(memory, g_matrix)
trellis.k =1 
trellis.n = 2
trellis.number_states=0
trellis.number_inputs = 0
trellis.total_memory = 0
x = np.array([1,0,1,0,1,1])
x=np.array(x);
print(cx.turbo_encode(x,trellis,trellis,cx.RandInterlv))

I get this error:

File "C:\Users\sankalp.1\AppData\Local\Programs\Python\Python37\lib\site-packages\commpy\utilities.py", line 50, in dec2bitarray
   bitarray[bit_width - i - 1] = int(binary_string[length - i - 1])
IndexError: index -1 is out of bounds for axis 0 with size 0

Can anyone help me figure out how to eliminate this error? It seems to be working fine in conv_encode.

image

Thank you.

I am also interested in an example for constructing correct trellis objects using this interface. I haven't encountered this specific error, but I am struggling to understand the format and specification of this library's representation of the trellis. @veeresht you were able to point me in the right direction on my last question, can you provide any insight here?

jeichenhofer avatar Jul 07 '20 18:07 jeichenhofer

Hi @jeichenhofer, I can't help you on turbocodes as I've never had a look to this module. However, regarding to the format and specifications of the trellis, you should have a look to conv_encode_decode example file. Be sure to use the github version as the pip version doesn't curretly have all the funtion required to run this file.

BastienTr avatar Jul 08 '20 11:07 BastienTr