29 lines
651 B
Python
29 lines
651 B
Python
|
#!/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_':
|
||
|
T = np.fromfile(infile, dtype=np.float32, count=1)
|
||
|
data = np.fromfile(infile, dtype=np.complex64)
|
||
|
else:
|
||
|
print(f"Error: Format {header} not implemented yet.")
|
||
|
exit(1)
|
||
|
|
||
|
t = np.arange(0, T*data.size, T)
|
||
|
|
||
|
amp = np.absolute(data)
|
||
|
phase = np.angle(data)
|
||
|
|
||
|
pp.plot(t, amp, 'r-')
|
||
|
pp.legend(['Amplitude'])
|
||
|
pp.twinx()
|
||
|
pp.plot(t, phase, 'b-')
|
||
|
pp.legend(['Phase [radians]'])
|
||
|
pp.xlabel('Time [s]')
|
||
|
pp.show()
|