aboutsummaryrefslogtreecommitdiffstats
path: root/src/gr-fadingui/python/qa_xor_frame_sync.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-11-22 19:59:14 +0100
committerNao Pross <np@0hm.ch>2021-11-22 19:59:14 +0100
commitec407f3bf29eca3271b428859b258b43222265c9 (patch)
treea62e18c762a256b2771029c5732d92cfdcda32f7 /src/gr-fadingui/python/qa_xor_frame_sync.py
parentMake install.sh run QA (diff)
downloadFading-ec407f3bf29eca3271b428859b258b43222265c9.tar.gz
Fading-ec407f3bf29eca3271b428859b258b43222265c9.zip
Implement frame synchronization
There is an issue somewhere between the mod and demod, since frame synchronization works on a direct path.
Diffstat (limited to '')
-rw-r--r--src/gr-fadingui/python/qa_xor_frame_sync.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/gr-fadingui/python/qa_xor_frame_sync.py b/src/gr-fadingui/python/qa_xor_frame_sync.py
new file mode 100644
index 0000000..280c694
--- /dev/null
+++ b/src/gr-fadingui/python/qa_xor_frame_sync.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gr_unittest, blocks
+
+from xor_frame_sync import xor_frame_sync
+import numpy as np
+
+
+class test_xor_frame_sync(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ """Test a byte aligned delay"""
+ pattern = np.array([0xbe, 0xef], dtype=np.uint8)
+ testdata = np.packbits(np.concatenate([
+ np.unpackbits(np.arange(0, 10, dtype=np.uint8)),
+ np.random.randint(0, 2, size = 8 * 5), np.unpackbits(pattern),
+ np.random.randint(0, 2, size = 64)
+ ]))
+
+ src = blocks.vector_source_b(testdata)
+ op = xor_frame_sync(pattern, 2048)
+ dst = blocks.vector_sink_b()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+
+ self.assertEqual(op.synchronized, True)
+
+ # FIXME: implement feature
+ # def test_002(self):
+ # """Test a byte unaligned delay"""
+ # pattern = np.array([0xbe, 0xef], dtype=np.uint8)
+ # testdata = np.packbits(np.concatenate([
+ # np.unpackbits(np.arange(0, 10, dtype=np.uint8)),
+ # np.random.randint(0, 2, size = (2 + 8 * 5)), np.unpackbits(pattern),
+ # np.random.randint(0, 2, size = 64)
+ # ]))
+
+ # src = blocks.vector_source_b(testdata)
+ # op = xor_frame_sync(pattern, 2048)
+ # dst = blocks.vector_sink_b()
+
+ # self.tb.connect(src, op, dst)
+ # self.tb.run()
+
+ # self.assertEqual(op.synchronized, True)
+
+
+if __name__ == "__main__":
+ gr_unittest.run(test_xor_frame_sync)