summaryrefslogtreecommitdiff
path: root/gr-fec/python/fec/polar/testbed.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-fec/python/fec/polar/testbed.py')
-rw-r--r--[-rwxr-xr-x]gr-fec/python/fec/polar/testbed.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/gr-fec/python/fec/polar/testbed.py b/gr-fec/python/fec/polar/testbed.py
index 3f8e814e4f..08ef0de558 100755..100644
--- a/gr-fec/python/fec/polar/testbed.py
+++ b/gr-fec/python/fec/polar/testbed.py
@@ -18,11 +18,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
-from encoder import PolarEncoder
-from decoder import PolarDecoder
-import channel_construction as cc
-from helper_functions import *
+
+from .encoder import PolarEncoder
+from .decoder import PolarDecoder
+from . import channel_construction as cc
+from .helper_functions import *
import matplotlib.pyplot as plt
@@ -58,13 +63,13 @@ def is_equal(first, second):
if not (first == second).all():
result = first == second
for i in range(len(result)):
- print '{0:4}: {1:2} == {2:1} = {3}'.format(i, first[i], second[i], result[i])
+ print('{0:4}: {1:2} == {2:1} = {3}'.format(i, first[i], second[i], result[i]))
return False
return True
def exact_value(la, lb):
- return np.log((np.exp(la + lb) + 1) / (np.exp(la) + np.exp(lb)))
+ return np.log((np.exp(la + lb) + 1) / (np.exp(la + np.exp(lb))))
def approx_value(la, lb):
@@ -112,7 +117,7 @@ def test_1024_rate_1_code():
recv = decoder.decode(rx)
channel_counter += (bits == recv)
- print channel_counter
+ print(channel_counter)
print(np.min(channel_counter), np.max(channel_counter))
np.save('channel_counter_' + str(ntests) + '.npy', channel_counter)
@@ -330,7 +335,7 @@ def main():
# frozenbits = np.zeros(n - k)
# frozenbitposition8 = np.array((0, 1, 2, 4), dtype=int)
# frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
- # print frozenbitposition
+ # print(frozenbitposition)
# test_enc_dec_chain()
# test_1024_rate_1_code()