Skip to content
Snippets Groups Projects
Commit 7f649bb9 authored by xiyehu2's avatar xiyehu2
Browse files

sync push

parent 078382b0
No related branches found
No related tags found
No related merge requests found
...@@ -5,37 +5,39 @@ from scipy.interpolate import interp1d ...@@ -5,37 +5,39 @@ from scipy.interpolate import interp1d
import os import os
from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.axes_grid1 import make_axes_locatable
# file = np.load("data/waveform_data.npz", allow_pickle=True)
# signal = file['signal']
# wfm = file['wfm'].item()
# sr = wfm.sample_rate
file = np.load("data/waveform_data.npz", allow_pickle=True) sr = 614.4e6
signal = file['signal']
wfm = file['wfm'].item()
sr = wfm.sample_rate
signal_bad = np.loadtxt("data/wfm.csv", delimiter=',')
signal_good = np.load("data/test.npy")
signal = signal_bad
f, t, Sxx = scisig.stft(signal, fs=sr, nperseg=256*100) f, t, Sxx = scisig.stft(signal, fs=sr, nperseg=256*100)
f /= 1e6 f /= 1e6
t *= 1e3 t *= 1e3
Sxx[abs(Sxx) < 0.01] = 0 Sxx[abs(Sxx) < 0.01] = 0
f_plot = np.logical_and(f > 90, f < 120)
fig, ax = plt.subplots() fig, ax = plt.subplots()
im = ax.pcolormesh(t, f, np.abs(Sxx), shading='gouraud') im = ax.pcolormesh(t, f[f_plot], np.abs(Sxx[f_plot, :]), shading='gouraud')
plt.title("Signal Spectrogram Frequency") plt.title("Signal Spectrogram Frequency")
plt.ylabel('Frequency [MHz]') plt.ylabel('Frequency [MHz]')
plt.xlabel('Time [ms]') plt.xlabel('Time [ms]')
plt.ylim(95,115)
divider = make_axes_locatable(ax) divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05) cax = divider.append_axes("right", size="5%", pad=0.05)
fig.colorbar(im, cax=cax) fig.colorbar(im, cax=cax)
if True: if True:
plt.savefig("data/Spectrogram-frequency.png", dpi=1200) plt.savefig("figs/Spectrogram-frequency.png", dpi=1200)
fig, ax = plt.subplots() fig, ax = plt.subplots()
im = ax.pcolormesh(t, f, np.angle(Sxx), shading='gouraud') im = ax.pcolormesh(t, f[f_plot], np.angle(Sxx[f_plot, :]), shading='gouraud')
plt.title("Signal Spectrogram Phase") plt.title("Signal Spectrogram Phase")
plt.ylabel('Frequency [MHz]') plt.ylabel('Frequency [MHz]')
plt.xlabel('Time [ms]') plt.xlabel('Time [ms]')
plt.ylim(95,115)
divider = make_axes_locatable(ax) divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05) cax = divider.append_axes("right", size="5%", pad=0.05)
fig.colorbar(im, cax=cax) fig.colorbar(im, cax=cax)
if True: if True:
plt.savefig("data/Spectrogram-phase.png", dpi=1200) plt.savefig("figs/Spectrogram-phase.png", dpi=1200)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment