aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fadingui/QAM/hammingtest.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-11-21 10:40:53 +0100
committerNao Pross <np@0hm.ch>2021-11-21 10:40:53 +0100
commit2a3b0ef715d83c97ccb0c2b1eb63707a62ffe7a5 (patch)
treef45e5b6f5ec5a88456d94abc0a63173f355d2571 /tests/fadingui/QAM/hammingtest.py
parentChange chapter title (diff)
parentMerge branch 'master' of github.com:NaoPross/Fading (diff)
downloadFading-2a3b0ef715d83c97ccb0c2b1eb63707a62ffe7a5.tar.gz
Fading-2a3b0ef715d83c97ccb0c2b1eb63707a62ffe7a5.zip
Merge branch 'master' of github.com:NaoPross/Fading
Diffstat (limited to 'tests/fadingui/QAM/hammingtest.py')
-rwxr-xr-xtests/fadingui/QAM/hammingtest.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fadingui/QAM/hammingtest.py b/tests/fadingui/QAM/hammingtest.py
new file mode 100755
index 0000000..b72e386
--- /dev/null
+++ b/tests/fadingui/QAM/hammingtest.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+import numpy as np
+from fadingui import frame_obj
+
+f = frame_obj([1,0], 10)
+q = np.random.randint(0, 2, size=26)
+
+parity = f.parity(q)
+enc = np.concatenate([q, parity])
+
+print(q)
+print(parity)
+print(enc)
+print(f.syndrome(enc))