55 lines
1.5 KiB
Python
Executable File
55 lines
1.5 KiB
Python
Executable File
#!/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)
|