Some python debug plot scripts
This commit is contained in:
parent
874d8d5073
commit
62ff2938ac
18
impl/utils/plot_constellation.py
Executable file
18
impl/utils/plot_constellation.py
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/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()
|
23
impl/utils/plot_timedomain.py
Executable file
23
impl/utils/plot_timedomain.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/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)
|
||||
|
||||
t = np.arange(0, T*data.size, T)
|
||||
|
||||
pp.plot(t, np.real(data), 'r-')
|
||||
pp.plot(t, np.imag(data), 'b-')
|
||||
pp.legend(['In-phase', 'Quadrature'])
|
||||
pp.xlabel('Time [s]')
|
||||
pp.show()
|
Loading…
Reference in a new issue