Debugging signal capture subsystem
This commit is contained in:
parent
9d72724ca5
commit
80de5c2e24
6 changed files with 300 additions and 6 deletions
|
|
@ -2,12 +2,14 @@
|
|||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import re\n",
|
||||
"import math\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
|
|
@ -18,13 +20,258 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib widget"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 51,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def read_freq_log(fn):\n",
|
||||
" with open(fn) as f:\n",
|
||||
" def parse_freq(f):\n",
|
||||
" try:\n",
|
||||
" return float(f)\n",
|
||||
" except:\n",
|
||||
" return 0\n",
|
||||
" freqs = np.trim_zeros(np.array([ parse_freq(line.split()[1]) for line in f.readlines() if re.match('\\d+: .*', line) ]))\n",
|
||||
" return freqs[np.nonzero(freqs)]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 64,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-64-bdef8329a3e8>:1: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n",
|
||||
" fig, axs = plt.subplots(2, 2, figsize=(15, 9))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "c040d7b8285a4444abc23ec0ef8c0d45",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fig, axs = plt.subplots(2, 2, figsize=(15, 9))\n",
|
||||
"ax1, ax2, ax3, ax4 = axs.flatten()\n",
|
||||
"\n",
|
||||
"freqs_mod, freqs_clean, freqs_clean_gnd = read_freq_log('/mnt/c/Users/jaseg/shared/dsss_test.log'), read_freq_log('/mnt/c/Users/jaseg/shared/dsss_test_50hz_clean.log'), read_freq_log('/mnt/c/Users/jaseg/shared/dsss_test_50hz_clean_gndtest.log')\n",
|
||||
"\n",
|
||||
"ax1.plot(freqs_mod)\n",
|
||||
"ax1.grid()\n",
|
||||
"\n",
|
||||
"ax2.plot(freqs_clean)\n",
|
||||
"ax2.grid()\n",
|
||||
"\n",
|
||||
"ax4.plot(freqs_clean_gnd)\n",
|
||||
"ax4.grid()\n",
|
||||
"\n",
|
||||
"w = 512\n",
|
||||
"\n",
|
||||
"ax3.psd(freqs_mod[:80000], w, 100/128 * 10)\n",
|
||||
"ax3.psd(freqs_clean[:80000], w, 100/128 * 10)\n",
|
||||
"ax3.psd(freqs_clean_gnd[:80000], w, 100/128 * 10)\n",
|
||||
"None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def read_raw_log(fn):\n",
|
||||
" with open(fn) as f:\n",
|
||||
" vals = np.array([ int(x, 16) for line in f for x in line.partition(':')[2].split() ])\n",
|
||||
" return vals"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f5f37f4970ae4d0fb5677c55045c6ebf",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fig, axs = plt.subplots(2, 2, figsize=(15, 9))\n",
|
||||
"ax1, ax2, ax3, ax4 = axs.flatten()\n",
|
||||
"\n",
|
||||
"raw_50hz, raw_silence = read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_50hz_clean.log'), read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_silence_clean3.log')\n",
|
||||
"\n",
|
||||
"ax1.plot(raw_50hz)\n",
|
||||
"ax1.grid()\n",
|
||||
"#for x in range(0, len(raw_50hz), 128):\n",
|
||||
"# ax1.axvline(x, color='red', alpha=0.3)\n",
|
||||
"\n",
|
||||
"ax2.plot(raw_silence)\n",
|
||||
"ax2.grid()\n",
|
||||
"#for x in range(0, len(raw_silence), 128):\n",
|
||||
"# ax2.axvline(x, color='red', alpha=0.3)\n",
|
||||
"\n",
|
||||
"w = 16384\n",
|
||||
"\n",
|
||||
"ax3.psd(raw_50hz, w, 1e3)\n",
|
||||
"\n",
|
||||
"ax4.psd(raw_silence, w, 1e3)\n",
|
||||
"None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "eba72dea09bc45ff9de68cb22b352fb3",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fig, ax = plt.subplots(figsize=(12, 6))\n",
|
||||
"\n",
|
||||
"raw_silence = read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_silence_clean.log')\n",
|
||||
"raw_silence2 = read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_silence_clean3.log')\n",
|
||||
"\n",
|
||||
"raw_silence = raw_silence.reshape([-1, 128])\n",
|
||||
"le_mean = raw_silence.mean(axis=0)\n",
|
||||
"ax.plot(le_mean - np.mean(le_mean))\n",
|
||||
"\n",
|
||||
"raw_silence2 = raw_silence2.reshape([-1, 128])\n",
|
||||
"le_mean2 = raw_silence2.mean(axis=0)\n",
|
||||
"ax.plot(le_mean2 - np.mean(le_mean2))\n",
|
||||
"ax.grid()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 90,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-90-5a220009d359>:1: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n",
|
||||
" fig, axs = plt.subplots(2, 2, figsize=(15, 9))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "d9143b226974466aaec05a70592ac69e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fig, axs = plt.subplots(2, 2, figsize=(15, 9))\n",
|
||||
"ax1, ax2, ax3, ax4 = axs.flatten()\n",
|
||||
"\n",
|
||||
"raw_d, raw_e = read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_test_d.log'), read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_test_e.log')\n",
|
||||
"\n",
|
||||
"ax1.plot(raw_d)\n",
|
||||
"ax1.grid()\n",
|
||||
"\n",
|
||||
"ax2.plot(raw_e)\n",
|
||||
"ax2.grid()\n",
|
||||
"\n",
|
||||
"w = 16384\n",
|
||||
"\n",
|
||||
"ax3.psd(raw_d, w, 1e3)\n",
|
||||
"ax4.psd(raw_e, w, 1e3)\n",
|
||||
"#ax3.psd(raw_silence, w, 1e3)\n",
|
||||
"None"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<ipython-input-79-e66d1dcc2be5>:1: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n",
|
||||
" fig, ax = plt.subplots(figsize=(9, 5))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "48b1d8b994594af79c3dca2bf9a6fb41",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"fig, ax = plt.subplots(figsize=(9, 5))\n",
|
||||
"\n",
|
||||
"raw_c = read_raw_log('/mnt/c/Users/jaseg/shared/rawlog_test_c.log')\n",
|
||||
"\n",
|
||||
"ax.plot(raw_c[1000:2000])\n",
|
||||
"ax.grid()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue