add magnitude visualisation

This commit is contained in:
Christos Falas 2024-12-29 12:30:26 +00:00
parent a9d05ca975
commit 671b3ae353
No known key found for this signature in database
2 changed files with 22 additions and 2 deletions

View File

@ -45,7 +45,27 @@ def get_data(sock: Subscriber):
subscriber_settings[sock] = (subcarrier, rx, tx) subscriber_settings[sock] = (subcarrier, rx, tx)
def add_data(new_data: npt.NDArray[np.complex128]): def add_data(
raw_data: npt.NDArray[np.complex128], new_data: npt.NDArray[np.complex128]
):
# magn = np.abs(raw_data)
# phase = np.angle(raw_data)
# new_mag = np.abs(new_data)
# new_phase = np.angle(new_data)
# fig, axs = plt.subplots(2, 2)
# axs[0, 0].plot(magn[:, 0, 0], c="b")
# axs[0, 0].plot(magn[:, 1, 0], c="orange")
# axs[1, 0].plot(new_mag[:, 0, 0], c="b")
# axs[1, 0].plot(new_mag[:, 1, 0], c="orange")
# axs[0, 1].plot(phase[:, 0, 0], c="b")
# axs[0, 1].plot(phase[:, 1, 0], c="orange")
# axs[1, 1].plot(new_phase[:, 0, 0], c="b")
# axs[1, 1].plot(new_phase[:, 1, 0], c="orange")
# fig.savefig("/tmp/plot.png")
# plt.close(fig)
global data global data
if data.size == 0: if data.size == 0:
data = np.expand_dims(new_data, axis=0) data = np.expand_dims(new_data, axis=0)

View File

@ -32,7 +32,7 @@ socket.addEventListener("message", function (msg) {
y: [[msg.data]], y: [[msg.data]],
}, },
[0], [0],
100, 300,
); );
}); });