aboutsummaryrefslogtreecommitdiffstats
path: root/tests/correlator/acproc.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/correlator/acproc.py')
-rwxr-xr-xtests/correlator/acproc.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/correlator/acproc.py b/tests/correlator/acproc.py
new file mode 100755
index 0000000..5f6ace3
--- /dev/null
+++ b/tests/correlator/acproc.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+
+import numpy as np
+import matplotlib.pyplot as plt
+import acgen
+
+# Parameters
+# samples per symbol
+sps = 4
+# number of initial bytes (to ignore)
+nzeros = 10
+# length of the access code in bytes
+aclen = 2
+
+# Create samples
+print("Modulating symbols")
+acgen.main()
+
+# Extract one sequence
+print("Extracting symbol sequence")
+
+# raw data
+data = np.fromfile("acgen.dat", dtype=np.complex64)
+plt.plot(data.real)
+plt.plot(data.imag)
+plt.title("Raw Data (time domain)")
+plt.show()
+
+# take only symbols
+symbols = data[1::sps]
+plt.plot(symbols.real, symbols.imag)
+plt.title("Symbols only (constellation)")
+plt.show()
+
+# where ac symbols start, in symbols
+ac_start = nzeros * 8
+ac_end = ac_start + aclen * 8
+
+ac = symbols[ac_start:ac_end]
+
+fig, (ax1, ax2) = plt.subplots(2, 1)
+fig.tight_layout()
+
+ax1.plot(ac.real, ac.imag)
+ax1.set_title("Symbols of Access Code (constellation)")
+
+ax2.plot(ac.real, ".-")
+ax2.plot(ac.imag, ".-")
+ax2.set_title("Symbols of Access Code (time)")
+plt.show()
+
+# print the symbols
+print(f"Generated {len(ac)} symbols from a {aclen} byte sequence")
+print(list(ac))
+print("Reversed symbols (for FIR filter)")
+print(list(ac[::-1]))