-
Notifications
You must be signed in to change notification settings - Fork 2
/
FEC.py
39 lines (32 loc) · 1.03 KB
/
FEC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import komm
class BCH:
def create_bch_codes(m, t):
"""
Creates BCH binary codes which can correct up to t bit errors
Parameters
----------
m : positive integer (>=3)
t : number of bit errors to be corrected
Returns
-------
instance of the BCH code
"""
code = komm.BCHCode(m,t)
return code
class ConvCode:
def create_conv_codes():
"""
Creates rate 1/2 convolutional code with [0o7, 0o5] as the feedforward polynomial
Parameters
----------
m : positive integer (>=3)
t : number of bit errors to be corrected
Returns
-------
instance of the BCH code
"""
code = komm.ConvolutionalCode(feedforward_polynomials=[[0o7, 0o5]])
# the traceback depth in the Viterbi algorithm
# usually 6 times the constraint length (3 in this case)
tblen = 18
return code, tblen