plot_spectrum: ensure that the t and f array sizes match
This commit is contained in:
parent
89f04b3ad0
commit
a124c04021
|
@ -14,7 +14,7 @@ with open(sys.argv[1], 'rb') as infile:
|
||||||
T = np.fromfile(infile, dtype=np.float32, count=1)
|
T = np.fromfile(infile, dtype=np.float32, count=1)
|
||||||
data = np.fromfile(infile, dtype=np.complex64)
|
data = np.fromfile(infile, dtype=np.complex64)
|
||||||
|
|
||||||
f = np.arange(-1/(2*T), 1/(2*T), 1/T/data.size)
|
f = np.arange(-1/(2*T), 1/(2*T), 1/T/data.size)[:data.size]
|
||||||
|
|
||||||
spec = 20*np.log10(np.absolute(np.fft.fftshift(np.fft.fft(data))) / data.size)
|
spec = 20*np.log10(np.absolute(np.fft.fftshift(np.fft.fft(data))) / data.size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue