Closed postrou closed 3 years ago
I'm not sure as I'm not a BCJR specialist but I think that this looks like the MAP BCJR decoder for convolutionnal codes:
The BCJR turbo code is just below: https://github.com/veeresht/CommPy/blob/5dba9a496835313fec7076407daddcbc702dfa09/commpy/channelcoding/turbo.py#L254-L259
However, I don't know why this convolutionnal decoder is in the turbo file.
But map_decode
needs two encoder outputs as its inputs: sys_symbols
and non_sys_symbols
, and conv_encode
gives only one output. Also in the original article about BCJR I haven't found anything about multiple inputs to decoder.
Let' have a look to the doc: https://github.com/veeresht/CommPy/blob/5dba9a496835313fec7076407daddcbc702dfa09/commpy/channelcoding/turbo.py#L166-L178
My understanding is that the decoder is designed for systematic convolutional code with rate 1/2. sys_symbol
corresponds to the systematic part and non_sys_symbols
to the other ones. This can be checked with the following code.
import numpy as np
import commpy.channelcoding as cc
from numpy.testing import assert_equal
treillis = cc.convcode.Trellis(np.array(2, ndmin=1), np.array((1, 7), ndmin=2))
message = np.random.choice((0, 1), 10000)
coded = cc.convcode.conv_encode(message, treillis, 'cont')
decoded = cc.turbo.map_decode(coded[::2], coded[1::2], treillis, chan.noise_std**2, np.zeros_like(coded[::2]))
assert_equal(decoded[1], message)
BTW do you think that this code should be added in commpy as a test file?
Thanks! Yes, I think, it should be added.
In the README it is stated, that there is a MAP decoder for convolutional codes, based on BCJR. But I can't find it. Only the one for turbo codes. Did I miss it?