hamnet70/impl/utils/plot_constellation.py

19 lines
455 B
Python
Raw Normal View History

2021-10-17 19:46:30 +02:00
#!/usr/bin/env python3
import sys
import numpy as np
import matplotlib.pyplot as pp
with open(sys.argv[1], 'rb') as infile:
header = infile.read(4)
if header != b'CPX_':
print(f"Error: not a complex signal file. Format {header} not implemented yet.")
exit(1)
T = np.fromfile(infile, dtype=np.float32, count=1)
data = np.fromfile(infile, dtype=np.complex64)
pp.plot(np.real(data), np.imag(data), 'x')
pp.show()