aboutsummaryrefslogtreecommitdiff
path: root/stm32/unittest/scripts/plot_ofdm_demod_syms
diff options
context:
space:
mode:
authorAuthor Name <[email protected]>2023-07-07 12:20:59 +0930
committerDavid Rowe <[email protected]>2023-07-07 12:29:06 +0930
commitac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch)
treea2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /stm32/unittest/scripts/plot_ofdm_demod_syms
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'stm32/unittest/scripts/plot_ofdm_demod_syms')
-rwxr-xr-xstm32/unittest/scripts/plot_ofdm_demod_syms54
1 files changed, 54 insertions, 0 deletions
diff --git a/stm32/unittest/scripts/plot_ofdm_demod_syms b/stm32/unittest/scripts/plot_ofdm_demod_syms
new file mode 100755
index 0000000..28eb063
--- /dev/null
+++ b/stm32/unittest/scripts/plot_ofdm_demod_syms
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+""" plot_ofdm_demod_syms
+
+ Plot QPSK constelations of reference demods.
+
+ Later read stm32 log......
+
+ """
+
+import numpy as np
+import os
+import sys
+
+
+##############################################################################
+# Read Octave text file
+##############################################################################
+
+def read_octave_text(fname):
+ data = {}
+ with open(fname, "r") as f:
+ for line in f:
+ if (line[0:8] == '# name: '):
+ var = line.split()[2]
+ print('found {}'.format(var))
+ line = next(f)
+ if (line.startswith('# type: matrix')):
+ line = next(f)
+ rows = int(line.split()[2])
+ line = next(f)
+ cols = int(line.split()[2])
+ print(' matrix({}, {})'.format(rows, cols))
+ data[var] = np.empty((rows, cols), np.float32)
+ # Read rows one at a time
+ for row in range(rows):
+ line = next(f)
+ data[var][row] = np.fromstring(line, np.float32, cols, ' ')
+
+ # end while True
+ # end with
+ return(data)
+
+
+##############################################################################
+# Main
+##############################################################################
+
+### Text not supported!!! ref_data = sio.loadmat('ofdm_demod_ref_log.mat')
+
+ref_data = read_octave_text('ofdm_demod_ref_log.txt')
+
+import pprint
+pp = pprint.PrettyPrinter(indent=4)
+pp.pprint(ref_data)