From f3f9d2f29efa7de1664c9bdf98987d7a2b7690be Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 25 Nov 2021 14:28:55 +0100 Subject: Create test files for correlator --- tests/correlator/acproc.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 tests/correlator/acproc.py (limited to 'tests/correlator/acproc.py') 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])) -- cgit v1.2.1