comnum.CcsdsTurbo#
- class comnum.CcsdsTurbo(k, rate='1/3', *, iterations=8, max_log=False)#
A turbo code of CCSDS 131.0-B-5, Sec. 6: two 16-state recursive encoders (
G0 = 23,G1 = 33,G2 = 25,G3 = 37in octal), the permutation of Sec. 6.3 g) fork= 1784, 3568, 7136 or 8920 bits, 4 termination steps, the outputs of Sec. 6.4 at rates 1/2, 1/3, 1/4 and 1/6,n = (k + 4)/r(Table 6-2); decoded by iterative log-MAP decoding.- Parameters:
- Raises:
ValueError – for another
kor rate.
Examples
>>> import comnum, numpy as np >>> code = comnum.CcsdsTurbo(1784, "1/3") >>> (code.k, code.n) (1784, 5364) >>> b = comnum.bits(1784, comnum.Rng(2)) >>> bool(np.array_equal(code.decode(2.0 - 4.0 * code.encode(b)), b)) True
- decode(llr)#
Decode whole codewords of LLRs.
- Parameters:
llr (array_like) – a multiple of
nLLRs (positive for a 0).- Returns:
kbits per codeword (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of numbers of the expected shape.
- encode(bits)#
Encode whole codewords.
- Parameters:
bits (array_like) – a multiple of
kbits.- Returns:
nbits per codeword (uint8).- Return type:
- Raises:
ValueError – for an input that is not an array of bits of the expected shape.
- permutation#
The permutation of the second encoder,
π(s)fors = 0, …, k − 1(int64): the encoder b reads the bitπ(s)at steps.- Type: