From d32422d11d38f6f5baaac9ac9204db79ef8bb11f Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 18 Feb 2020 11:48:08 +0000 Subject: SER calculation: Fix offset problem --- lab-windows/dsss_experiments-ber.ipynb | 312 +++++++++++++++++++++++++-------- lab-windows/dsss_experiments.ipynb | 177 +++++++------------ 2 files changed, 308 insertions(+), 181 deletions(-) diff --git a/lab-windows/dsss_experiments-ber.ipynb b/lab-windows/dsss_experiments-ber.ipynb index eda21d7..a5a2ad1 100644 --- a/lab-windows/dsss_experiments-ber.ipynb +++ b/lab-windows/dsss_experiments-ber.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 68, + "execution_count": 92, "metadata": {}, "outputs": [], "source": [ @@ -14,6 +14,7 @@ "import ipywidgets\n", "import itertools\n", "from multiprocessing import Pool\n", + "from collections import defaultdict\n", "\n", "import colorednoise\n", "\n", @@ -154,11 +155,11 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 100, "metadata": {}, "outputs": [], "source": [ - "def run_ser_test(sample_duration=128, nbits=6, signal_amplitude=2.0e-3, decimation=10, threshold_factor=4.0, power_avg_width=2.5, max_lookahead=6.5, seed=0, ax=None, print=print):\n", + "def run_ser_test(sample_duration=128, nbits=6, signal_amplitude=2.0e-3, decimation=10, threshold_factor=4.0, power_avg_width=2.5, max_lookahead=6.5, seed=0, ax=None, print=print, ser_maxshift=3):\n", "\n", " test_data, signal = generate_test_signal(sample_duration, nbits, signal_amplitude, decimation, seed)\n", " cor_an = correlate(signal, nbits=nbits, decimation=decimation)\n", @@ -271,14 +272,20 @@ "\n", " decoded = list(viz(chain))\n", " print('decoding [ref|dec]:')\n", - " failures = 0\n", - " for i, (ref, found) in enumerate(itertools.zip_longest(test_data, decoded)):\n", - " print(f'{ref or -1:>3d}|{found or -1:>3d} {\"✔\" if ref==found else \"✘\" if found else \" \"}', end=' ')\n", - " if ref != found:\n", - " failures += 1\n", - " if i%8 == 7:\n", + " failures = defaultdict(lambda: 0)\n", + " for shift in range(-ser_maxshift, ser_maxshift):\n", + " print(f'=== shift = {shift} ===')\n", + " a = test_data if shift > 0 else test_data[-shift:]\n", + " b = decoded if shift < 0 else decoded[shift:]\n", + " for i, (ref, found) in enumerate(itertools.zip_longest(a, b)):\n", + " print(f'{ref or -1:>3d}|{found or -1:>3d} {\"✔\" if ref==found else \"✘\" if found else \" \"}', end=' ')\n", + " if ref != found:\n", + " failures[shift] += 1\n", + " if i%8 == 7:\n", + " print()\n", + " if i%8 != 7:\n", " print()\n", - " ser = failures/len(test_data)\n", + " ser = min(failures.values())/len(test_data)\n", " print(f'Symbol error rate e={ser}')\n", " br = sampling_rate / decimation / (2**nbits) * nbits * (1 - ser) * 3600\n", " print(f'maximum bitrate r={br} b/h')\n", @@ -343,21 +350,21 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 111, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - ":13: 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", + ":13: 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=(12, 9))\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b5eb2cd4f4224f75bc3dc73b6143d849", + "model_id": "794478ea08254c9da3608685434de9d6", "version_major": 2, "version_minor": 0 }, @@ -373,73 +380,73 @@ "output_type": "stream", "text": [ "nbits=5\n", - "signal_amplitude=0.00029: ser=1.01000 ±0.012207515615390381, br=-5.62500\n", - "signal_amplitude=0.00020: ser=1.01469 ±0.013678792892649557, br=-8.26172\n", - "signal_amplitude=0.00052: ser=1.00406 ±0.018895270572288715, br=-2.28516\n", - "signal_amplitude=0.00043: ser=1.01000 ±0.018817586521655747, br=-5.62500\n", - "signal_amplitude=0.00024: ser=1.01156 ±0.014510233457804875, br=-6.50391\n", - "signal_amplitude=0.00036: ser=1.00687 ±0.014875787794264881, br=-3.86719\n", - "signal_amplitude=0.00032: ser=1.01156 ±0.01837117307087384, br=-6.50391\n", - "signal_amplitude=0.00022: ser=1.01000 ±0.013535254892317322, br=-5.62500\n", - "signal_amplitude=0.00057: ser=1.00281 ±0.012476540486048206, br=-1.58203\n", - "signal_amplitude=0.00039: ser=1.00812 ±0.014402148277253642, br=-4.57031\n", - "signal_amplitude=0.00047: ser=1.00438 ±0.012899854650343935, br=-2.46094\n", - "signal_amplitude=0.00027: ser=1.00937 ±0.014657549249448218, br=-5.27344\n", - "signal_amplitude=0.00063: ser=0.99938 ±0.019253652250936705, br=0.35156\n", - "signal_amplitude=0.00077: ser=0.99156 ±0.03231920868461974, br=4.74609\n", - "signal_amplitude=0.00093: ser=0.95156 ±0.06625442202223185, br=27.24609\n", - "signal_amplitude=0.00112: ser=0.76000 ±0.2099632594348354, br=135.00000\n", - "signal_amplitude=0.00136: ser=0.51375 ±0.30673813139223494, br=273.51562\n", - "signal_amplitude=0.00165: ser=0.39844 ±0.38814210912370745, br=338.37891\n", - "signal_amplitude=0.00070: ser=0.99281 ±0.023688242072809035, br=4.04297\n", - "signal_amplitude=0.00084: ser=0.96375 ±0.050769469787461836, br=20.39062\n", - "signal_amplitude=0.00102: ser=0.91063 ±0.10310321739645179, br=50.27344\n", - "signal_amplitude=0.00124: ser=0.72500 ±0.23567348639059932, br=154.68750\n", - "signal_amplitude=0.00150: ser=0.40969 ±0.3064419041596629, br=332.05078\n", - "signal_amplitude=0.00182: ser=0.32531 ±0.38085840544748384, br=379.51172\n", - "signal_amplitude=0.00200: ser=0.29000 ±0.3885339029608613, br=399.37500\n", + "signal_amplitude=0.00029: ser=0.99141 ±0.01434, br=4.83398\n", + "signal_amplitude=0.00020: ser=0.99344 ±0.01365, br=3.69141\n", + "signal_amplitude=0.00052: ser=0.98953 ±0.01621, br=5.88867\n", + "signal_amplitude=0.00024: ser=0.98984 ±0.01426, br=5.71289\n", + "signal_amplitude=0.00043: ser=0.98906 ±0.01531, br=6.15234\n", + "signal_amplitude=0.00036: ser=0.98859 ±0.01451, br=6.41602\n", + "signal_amplitude=0.00032: ser=0.98531 ±0.01621, br=8.26172\n", + "signal_amplitude=0.00022: ser=0.99125 ±0.01377, br=4.92188\n", + "signal_amplitude=0.00027: ser=0.99172 ±0.01339, br=4.65820\n", + "signal_amplitude=0.00047: ser=0.98938 ±0.01821, br=5.97656\n", + "signal_amplitude=0.00057: ser=0.98453 ±0.02223, br=8.70117\n", + "signal_amplitude=0.00039: ser=0.99328 ±0.01499, br=3.77930\n", + "signal_amplitude=0.00063: ser=0.97531 ±0.02277, br=13.88672\n", + "signal_amplitude=0.00077: ser=0.95766 ±0.03962, br=23.81836\n", + "signal_amplitude=0.00093: ser=0.89844 ±0.07690, br=57.12891\n", + "signal_amplitude=0.00112: ser=0.69250 ±0.15978, br=172.96875\n", + "signal_amplitude=0.00136: ser=0.34797 ±0.13550, br=366.76758\n", + "signal_amplitude=0.00165: ser=0.15875 ±0.07678, br=473.20312\n", + "signal_amplitude=0.00070: ser=0.97562 ±0.02444, br=13.71094\n", + "signal_amplitude=0.00084: ser=0.93437 ±0.05440, br=36.91406\n", + "signal_amplitude=0.00102: ser=0.83734 ±0.10122, br=91.49414\n", + "signal_amplitude=0.00124: ser=0.56047 ±0.18288, br=247.23633\n", + "signal_amplitude=0.00150: ser=0.24266 ±0.09904, br=426.00586\n", + "signal_amplitude=0.00182: ser=0.10359 ±0.03178, br=504.22852\n", + "signal_amplitude=0.00200: ser=0.06453 ±0.03562, br=526.20117\n", "nbits=6\n", - "signal_amplitude=0.00052: ser=1.00375 ±0.027432445434193427, br=-1.26562\n", - "signal_amplitude=0.00029: ser=1.01531 ±0.013528038013695853, br=-5.16797\n", - "signal_amplitude=0.00020: ser=1.02000 ±0.01698459780212649, br=-6.75000\n", - "signal_amplitude=0.00024: ser=1.01844 ±0.0197494066366562, br=-6.22266\n", - "signal_amplitude=0.00043: ser=1.01000 ±0.013535254892317322, br=-3.37500\n", - "signal_amplitude=0.00036: ser=1.01500 ±0.01860884366369926, br=-5.06250\n", - "signal_amplitude=0.00032: ser=1.00906 ±0.01443601182806387, br=-3.05859\n", - "signal_amplitude=0.00022: ser=1.01656 ±0.015200483133769137, br=-5.58984\n", - "signal_amplitude=0.00057: ser=0.98281 ±0.04926213365760764, br=5.80078\n", - "signal_amplitude=0.00027: ser=1.02000 ±0.015946688527716343, br=-6.75000\n", - "signal_amplitude=0.00047: ser=1.00687 ±0.02815276407388802, br=-2.32031\n", - "signal_amplitude=0.00039: ser=1.00906 ±0.016189792308735775, br=-3.05859\n", - "signal_amplitude=0.00077: ser=0.76906 ±0.23454244018940368, br=77.94141\n", - "signal_amplitude=0.00063: ser=0.94031 ±0.08557822627572974, br=20.14453\n", - "signal_amplitude=0.00112: ser=0.29750 ±0.347296478171029, br=237.09375\n", - "signal_amplitude=0.00093: ser=0.50125 ±0.3293776683952632, br=168.32812\n", - "signal_amplitude=0.00136: ser=0.37250 ±0.42536588111001566, br=211.78125\n", - "signal_amplitude=0.00165: ser=0.51000 ±0.46215950303980546, br=165.37500\n", - "signal_amplitude=0.00070: ser=0.90063 ±0.1848975645458858, br=33.53906\n", - "signal_amplitude=0.00084: ser=0.64687 ±0.26652421325275494, br=119.17969\n", - "signal_amplitude=0.00124: ser=0.38500 ±0.39889079606767064, br=207.56250\n", - "signal_amplitude=0.00102: ser=0.40875 ±0.3467111099315971, br=199.54688\n", - "signal_amplitude=0.00150: ser=0.40375 ±0.4435118198819508, br=201.23438\n", - "signal_amplitude=0.00182: ser=0.58531 ±0.46179168734397985, br=139.95703\n", - "signal_amplitude=0.00200: ser=0.61594 ±0.4584529436730666, br=129.62109\n" + "signal_amplitude=0.00024: ser=1.00156 ±0.01855, br=-0.52734\n", + "signal_amplitude=0.00020: ser=1.00172 ±0.01365, br=-0.58008\n", + "signal_amplitude=0.00052: ser=0.95688 ±0.04998, br=14.55469\n", + "signal_amplitude=0.00029: ser=1.00078 ±0.01391, br=-0.26367\n", + "signal_amplitude=0.00043: ser=0.98406 ±0.02215, br=5.37891\n", + "signal_amplitude=0.00036: ser=0.99844 ±0.01733, br=0.52734\n", + "signal_amplitude=0.00027: ser=0.99469 ±0.01339, br=1.79297\n", + "signal_amplitude=0.00032: ser=0.99766 ±0.01541, br=0.79102\n", + "signal_amplitude=0.00047: ser=0.97813 ±0.03233, br=7.38281\n", + "signal_amplitude=0.00022: ser=1.00016 ±0.01612, br=-0.05273\n", + "signal_amplitude=0.00057: ser=0.93609 ±0.07689, br=21.56836\n", + "signal_amplitude=0.00039: ser=0.99625 ±0.01883, br=1.26562\n", + "signal_amplitude=0.00063: ser=0.86875 ±0.08992, br=44.29688\n", + "signal_amplitude=0.00077: ser=0.58109 ±0.17566, br=141.38086\n", + "signal_amplitude=0.00093: ser=0.28594 ±0.13348, br=240.99609\n", + "signal_amplitude=0.00112: ser=0.12547 ±0.06352, br=295.15430\n", + "signal_amplitude=0.00165: ser=0.06500 ±0.01642, br=315.56250\n", + "signal_amplitude=0.00136: ser=0.08516 ±0.06513, br=308.75977\n", + "signal_amplitude=0.00070: ser=0.75609 ±0.15173, br=82.31836\n", + "signal_amplitude=0.00084: ser=0.46125 ±0.18383, br=181.82812\n", + "signal_amplitude=0.00102: ser=0.19703 ±0.10488, br=271.00195\n", + "signal_amplitude=0.00124: ser=0.10562 ±0.06833, br=301.85156\n", + "signal_amplitude=0.00182: ser=0.06563 ±0.02007, br=315.35156\n", + "signal_amplitude=0.00150: ser=0.06984 ±0.01818, br=313.92773\n", + "signal_amplitude=0.00200: ser=0.06500 ±0.02196, br=315.56250\n" ] }, { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 84, + "execution_count": 111, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sample_duration=128\n", - "sample_reps = 25\n", + "sample_reps = 50\n", "sweep_points = 25\n", "\n", "default_params = dict(\n", @@ -461,24 +468,185 @@ " params['nbits'] = nbits\n", " sers, brs = [], []\n", " for i in range(sample_reps):\n", - " ser, br = run_ser_test(**params, sample_duration=sample_duration, print=noprint, seed=np.random.randint(0xffffffff))\n", + " seed = np.random.randint(0xffffffff)\n", + " ser, br = run_ser_test(**params, sample_duration=sample_duration, print=noprint, seed=seed)\n", " sers.append(ser)\n", " brs.append(br)\n", + " #print(f'nbits={nbits} ampl={v:>.5f} seed={seed:08x} > ser={ser:.5f}')\n", " sers, brs = np.array(sers), np.array(brs)\n", - " ser = np.mean(sers)\n", - " print(f'signal_amplitude={v:<.5f}: ser={ser:<.5f} ±{np.std(sers):<.5f}, br={np.mean(brs):<.5f}')\n", - " return ser\n", + " ser, std = np.mean(sers), np.std(sers)\n", + " print(f'signal_amplitude={v:<.5f}: ser={ser:<.5f} ±{std:<.5f}, br={np.mean(brs):<.5f}')\n", + " return ser, std\n", " \n", " vs = 0.2e-3 * 10 ** np.linspace(0, 1.0, sweep_points)\n", " with Pool(6) as p:\n", - " data = p.map(calculate_ser, vs)\n", + " data = np.array(p.map(calculate_ser, vs))\n", + " sers, stds = data[:,0], data[:,1]\n", " \n", - " ax.plot(vs, data, label=f'{nbits} bit')\n", + " l, = ax.plot(vs, np.clip(sers, 0, 1), label=f'{nbits} bit')\n", + " ax.fill_between(vs, np.clip(sers + stds, 0, 1), np.clip(sers - stds, 0, 1), facecolor=l.get_color(), alpha=0.3)\n", "ax.grid()\n", "ax.set_xlabel('Amplitude in mHz')\n", "ax.set_ylabel('Symbol error rate')\n", "ax.legend()" ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + ":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=(12, 9))\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "cfaf2edf2f214ca6a3e97994a14a80f5", + "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" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "avg_peak 1.6752232386509318\n", + "skipped 2 symbols at 15749.0\n", + "skipped 3 symbols at 42209.0\n", + "skipped 2 symbols at 57959.5\n", + "skipped 2 symbols at 61108.5\n", + "skipped 2 symbols at 77489.5\n", + "decoding [ref|dec]:\n", + "=== shift = -3 ===\n", + "102| 69 ✘ 2|124 ✘ 3|102 ✘ 78| 2 ✘ 29| 3 ✘ 122| 78 ✘ 73| 29 ✘ 98|123 ✘ \n", + " 34| 73 ✘ -1| 98 ✘ 97| 34 ✘ 7| -1 97| 97 ✔ 86| 7 ✘ 120| 97 ✘ 95| 86 ✘ \n", + " 90|120 ✘ 49| 95 ✘ 89| 90 ✘ 83| 49 ✘ 19| 89 ✘ 84| 83 ✘ 117| -1 92| 84 ✘ \n", + "119|117 ✘ 16| 92 ✘ 45|119 ✘ 23| 16 ✘ 16| 45 ✘ 111| 23 ✘ 9| 16 ✘ 89|111 ✘ \n", + " 18| 9 ✘ 36| 89 ✘ 2| 18 ✘ 115| 36 ✘ 40| 2 ✘ 100|115 ✘ 105| 40 ✘ 93|100 ✘ \n", + " 85|105 ✘ 107| 93 ✘ 90| 85 ✘ 62|107 ✘ 116| 90 ✘ 42| 62 ✘ 123|116 ✘ 40| 42 ✘ \n", + " -1|123 ✘ 77| 40 ✘ 40| -1 57| 77 ✘ 110| 40 ✘ 29| 57 ✘ 94|110 ✘ 1| 29 ✘ \n", + " 29| 94 ✘ 71| 1 ✘ 119| 29 ✘ 15| 71 ✘ 115|119 ✘ 120| 15 ✘ 70|115 ✘ 50| -1 \n", + " 71| -1 50| 50 ✔ 61| 71 ✘ 38| 50 ✘ 4| 61 ✘ 3| 38 ✘ 124| 4 ✘ 95| 3 ✘ \n", + " 27|124 ✘ 48| 95 ✘ 116| 27 ✘ 3| 64 ✘ 63|116 ✘ 19| 3 ✘ 79| 63 ✘ 2| 19 ✘ \n", + " 43| 79 ✘ 92| 2 ✘ 8| 43 ✘ 65| 92 ✘ 35| 8 ✘ 30| 65 ✘ 73| 35 ✘ 73| 30 ✘ \n", + " 38| 73 ✘ 58| -1 49| 38 ✘ 45| 58 ✘ 58| 49 ✘ 46| 45 ✘ 116| -1 101| 46 ✘ \n", + " 5|116 ✘ 78|101 ✘ 126| 5 ✘ 105| 78 ✘ 108|126 ✘ 59| 76 ✘ 46|108 ✘ 27| 59 ✘ \n", + " 14| 46 ✘ 57| 27 ✘ 81| 14 ✘ 3| 57 ✘ 9| 81 ✘ 126| 3 ✘ 18| 9 ✘ 76|126 ✘ \n", + "101| 55 ✘ 124| 76 ✘ 4|101 ✘ 3|124 ✘ 102| 4 ✘ 79| 3 ✘ 121|102 ✘ 103| 79 ✘ \n", + " 92| -1 30|103 ✘ 4| 92 ✘ 103| 30 ✘ 59| 4 ✘ -1|103 ✘ -1| 48 ✘ \n", + "=== shift = -2 ===\n", + "124| 69 ✘ 102|124 ✘ 2|102 ✘ 3| 2 ✘ 78| 3 ✘ 29| 78 ✘ 122| 29 ✘ 73|123 ✘ \n", + " 98| 73 ✘ 34| 98 ✘ -1| 34 ✘ 97| -1 7| 97 ✘ 97| 7 ✘ 86| 97 ✘ 120| 86 ✘ \n", + " 95|120 ✘ 90| 95 ✘ 49| 90 ✘ 89| 49 ✘ 83| 89 ✘ 19| 83 ✘ 84| -1 117| 84 ✘ \n", + " 92|117 ✘ 119| 92 ✘ 16|119 ✘ 45| 16 ✘ 23| 45 ✘ 16| 23 ✘ 111| 16 ✘ 9|111 ✘ \n", + " 89| 9 ✘ 18| 89 ✘ 36| 18 ✘ 2| 36 ✘ 115| 2 ✘ 40|115 ✘ 100| 40 ✘ 105|100 ✘ \n", + " 93|105 ✘ 85| 93 ✘ 107| 85 ✘ 90|107 ✘ 62| 90 ✘ 116| 62 ✘ 42|116 ✘ 123| 42 ✘ \n", + " 40|123 ✘ -1| 40 ✘ 77| -1 40| 77 ✘ 57| 40 ✘ 110| 57 ✘ 29|110 ✘ 94| 29 ✘ \n", + " 1| 94 ✘ 29| 1 ✘ 71| 29 ✘ 119| 71 ✘ 15|119 ✘ 115| 15 ✘ 120|115 ✘ 70| -1 \n", + " 50| -1 71| 50 ✘ 50| 71 ✘ 61| 50 ✘ 38| 61 ✘ 4| 38 ✘ 3| 4 ✘ 124| 3 ✘ \n", + " 95|124 ✘ 27| 95 ✘ 48| 27 ✘ 116| 64 ✘ 3|116 ✘ 63| 3 ✘ 19| 63 ✘ 79| 19 ✘ \n", + " 2| 79 ✘ 43| 2 ✘ 92| 43 ✘ 8| 92 ✘ 65| 8 ✘ 35| 65 ✘ 30| 35 ✘ 73| 30 ✘ \n", + " 73| 73 ✔ 38| -1 58| 38 ✘ 49| 58 ✘ 45| 49 ✘ 58| 45 ✘ 46| -1 116| 46 ✘ \n", + "101|116 ✘ 5|101 ✘ 78| 5 ✘ 126| 78 ✘ 105|126 ✘ 108| 76 ✘ 59|108 ✘ 46| 59 ✘ \n", + " 27| 46 ✘ 14| 27 ✘ 57| 14 ✘ 81| 57 ✘ 3| 81 ✘ 9| 3 ✘ 126| 9 ✘ 18|126 ✘ \n", + " 76| 55 ✘ 101| 76 ✘ 124|101 ✘ 4|124 ✘ 3| 4 ✘ 102| 3 ✘ 79|102 ✘ 121| 79 ✘ \n", + "103| -1 92|103 ✘ 30| 92 ✘ 4| 30 ✘ 103| 4 ✘ 59|103 ✘ -1| 48 ✘ \n", + "=== shift = -1 ===\n", + " 69| 69 ✔ 124|124 ✔ 102|102 ✔ 2| 2 ✔ 3| 3 ✔ 78| 78 ✔ 29| 29 ✔ 122|123 ✘ \n", + " 73| 73 ✔ 98| 98 ✔ 34| 34 ✔ -1| -1 ✔ 97| 97 ✔ 7| 7 ✔ 97| 97 ✔ 86| 86 ✔ \n", + "120|120 ✔ 95| 95 ✔ 90| 90 ✔ 49| 49 ✔ 89| 89 ✔ 83| 83 ✔ 19| -1 84| 84 ✔ \n", + "117|117 ✔ 92| 92 ✔ 119|119 ✔ 16| 16 ✔ 45| 45 ✔ 23| 23 ✔ 16| 16 ✔ 111|111 ✔ \n", + " 9| 9 ✔ 89| 89 ✔ 18| 18 ✔ 36| 36 ✔ 2| 2 ✔ 115|115 ✔ 40| 40 ✔ 100|100 ✔ \n", + "105|105 ✔ 93| 93 ✔ 85| 85 ✔ 107|107 ✔ 90| 90 ✔ 62| 62 ✔ 116|116 ✔ 42| 42 ✔ \n", + "123|123 ✔ 40| 40 ✔ -1| -1 ✔ 77| 77 ✔ 40| 40 ✔ 57| 57 ✔ 110|110 ✔ 29| 29 ✔ \n", + " 94| 94 ✔ 1| 1 ✔ 29| 29 ✔ 71| 71 ✔ 119|119 ✔ 15| 15 ✔ 115|115 ✔ 120| -1 \n", + " 70| -1 50| 50 ✔ 71| 71 ✔ 50| 50 ✔ 61| 61 ✔ 38| 38 ✔ 4| 4 ✔ 3| 3 ✔ \n", + "124|124 ✔ 95| 95 ✔ 27| 27 ✔ 48| 64 ✘ 116|116 ✔ 3| 3 ✔ 63| 63 ✔ 19| 19 ✔ \n", + " 79| 79 ✔ 2| 2 ✔ 43| 43 ✔ 92| 92 ✔ 8| 8 ✔ 65| 65 ✔ 35| 35 ✔ 30| 30 ✔ \n", + " 73| 73 ✔ 73| -1 38| 38 ✔ 58| 58 ✔ 49| 49 ✔ 45| 45 ✔ 58| -1 46| 46 ✔ \n", + "116|116 ✔ 101|101 ✔ 5| 5 ✔ 78| 78 ✔ 126|126 ✔ 105| 76 ✘ 108|108 ✔ 59| 59 ✔ \n", + " 46| 46 ✔ 27| 27 ✔ 14| 14 ✔ 57| 57 ✔ 81| 81 ✔ 3| 3 ✔ 9| 9 ✔ 126|126 ✔ \n", + " 18| 55 ✘ 76| 76 ✔ 101|101 ✔ 124|124 ✔ 4| 4 ✔ 3| 3 ✔ 102|102 ✔ 79| 79 ✔ \n", + "121| -1 103|103 ✔ 92| 92 ✔ 30| 30 ✔ 4| 4 ✔ 103|103 ✔ 59| 48 ✘ \n", + "=== shift = 0 ===\n", + " 10| 69 ✘ 69|124 ✘ 124|102 ✘ 102| 2 ✘ 2| 3 ✘ 3| 78 ✘ 78| 29 ✘ 29|123 ✘ \n", + "122| 73 ✘ 73| 98 ✘ 98| 34 ✘ 34| -1 -1| 97 ✘ 97| 7 ✘ 7| 97 ✘ 97| 86 ✘ \n", + " 86|120 ✘ 120| 95 ✘ 95| 90 ✘ 90| 49 ✘ 49| 89 ✘ 89| 83 ✘ 83| -1 19| 84 ✘ \n", + " 84|117 ✘ 117| 92 ✘ 92|119 ✘ 119| 16 ✘ 16| 45 ✘ 45| 23 ✘ 23| 16 ✘ 16|111 ✘ \n", + "111| 9 ✘ 9| 89 ✘ 89| 18 ✘ 18| 36 ✘ 36| 2 ✘ 2|115 ✘ 115| 40 ✘ 40|100 ✘ \n", + "100|105 ✘ 105| 93 ✘ 93| 85 ✘ 85|107 ✘ 107| 90 ✘ 90| 62 ✘ 62|116 ✘ 116| 42 ✘ \n", + " 42|123 ✘ 123| 40 ✘ 40| -1 -1| 77 ✘ 77| 40 ✘ 40| 57 ✘ 57|110 ✘ 110| 29 ✘ \n", + " 29| 94 ✘ 94| 1 ✘ 1| 29 ✘ 29| 71 ✘ 71|119 ✘ 119| 15 ✘ 15|115 ✘ 115| -1 \n", + "120| -1 70| 50 ✘ 50| 71 ✘ 71| 50 ✘ 50| 61 ✘ 61| 38 ✘ 38| 4 ✘ 4| 3 ✘ \n", + " 3|124 ✘ 124| 95 ✘ 95| 27 ✘ 27| 64 ✘ 48|116 ✘ 116| 3 ✘ 3| 63 ✘ 63| 19 ✘ \n", + " 19| 79 ✘ 79| 2 ✘ 2| 43 ✘ 43| 92 ✘ 92| 8 ✘ 8| 65 ✘ 65| 35 ✘ 35| 30 ✘ \n", + " 30| 73 ✘ 73| -1 73| 38 ✘ 38| 58 ✘ 58| 49 ✘ 49| 45 ✘ 45| -1 58| 46 ✘ \n", + " 46|116 ✘ 116|101 ✘ 101| 5 ✘ 5| 78 ✘ 78|126 ✘ 126| 76 ✘ 105|108 ✘ 108| 59 ✘ \n", + " 59| 46 ✘ 46| 27 ✘ 27| 14 ✘ 14| 57 ✘ 57| 81 ✘ 81| 3 ✘ 3| 9 ✘ 9|126 ✘ \n", + "126| 55 ✘ 18| 76 ✘ 76|101 ✘ 101|124 ✘ 124| 4 ✘ 4| 3 ✘ 3|102 ✘ 102| 79 ✘ \n", + " 79| -1 121|103 ✘ 103| 92 ✘ 92| 30 ✘ 30| 4 ✘ 4|103 ✘ 103| 48 ✘ 59| -1 \n", + "=== shift = 1 ===\n", + " 10|124 ✘ 69|102 ✘ 124| 2 ✘ 102| 3 ✘ 2| 78 ✘ 3| 29 ✘ 78|123 ✘ 29| 73 ✘ \n", + "122| 98 ✘ 73| 34 ✘ 98| -1 34| 97 ✘ -1| 7 ✘ 97| 97 ✔ 7| 86 ✘ 97|120 ✘ \n", + " 86| 95 ✘ 120| 90 ✘ 95| 49 ✘ 90| 89 ✘ 49| 83 ✘ 89| -1 83| 84 ✘ 19|117 ✘ \n", + " 84| 92 ✘ 117|119 ✘ 92| 16 ✘ 119| 45 ✘ 16| 23 ✘ 45| 16 ✘ 23|111 ✘ 16| 9 ✘ \n", + "111| 89 ✘ 9| 18 ✘ 89| 36 ✘ 18| 2 ✘ 36|115 ✘ 2| 40 ✘ 115|100 ✘ 40|105 ✘ \n", + "100| 93 ✘ 105| 85 ✘ 93|107 ✘ 85| 90 ✘ 107| 62 ✘ 90|116 ✘ 62| 42 ✘ 116|123 ✘ \n", + " 42| 40 ✘ 123| -1 40| 77 ✘ -1| 40 ✘ 77| 57 ✘ 40|110 ✘ 57| 29 ✘ 110| 94 ✘ \n", + " 29| 1 ✘ 94| 29 ✘ 1| 71 ✘ 29|119 ✘ 71| 15 ✘ 119|115 ✘ 15| -1 115| -1 \n", + "120| 50 ✘ 70| 71 ✘ 50| 50 ✔ 71| 61 ✘ 50| 38 ✘ 61| 4 ✘ 38| 3 ✘ 4|124 ✘ \n", + " 3| 95 ✘ 124| 27 ✘ 95| 64 ✘ 27|116 ✘ 48| 3 ✘ 116| 63 ✘ 3| 19 ✘ 63| 79 ✘ \n", + " 19| 2 ✘ 79| 43 ✘ 2| 92 ✘ 43| 8 ✘ 92| 65 ✘ 8| 35 ✘ 65| 30 ✘ 35| 73 ✘ \n", + " 30| -1 73| 38 ✘ 73| 58 ✘ 38| 49 ✘ 58| 45 ✘ 49| -1 45| 46 ✘ 58|116 ✘ \n", + " 46|101 ✘ 116| 5 ✘ 101| 78 ✘ 5|126 ✘ 78| 76 ✘ 126|108 ✘ 105| 59 ✘ 108| 46 ✘ \n", + " 59| 27 ✘ 46| 14 ✘ 27| 57 ✘ 14| 81 ✘ 57| 3 ✘ 81| 9 ✘ 3|126 ✘ 9| 55 ✘ \n", + "126| 76 ✘ 18|101 ✘ 76|124 ✘ 101| 4 ✘ 124| 3 ✘ 4|102 ✘ 3| 79 ✘ 102| -1 \n", + " 79|103 ✘ 121| 92 ✘ 103| 30 ✘ 92| 4 ✘ 30|103 ✘ 4| 48 ✘ 103| -1 59| -1 \n", + "=== shift = 2 ===\n", + " 10|102 ✘ 69| 2 ✘ 124| 3 ✘ 102| 78 ✘ 2| 29 ✘ 3|123 ✘ 78| 73 ✘ 29| 98 ✘ \n", + "122| 34 ✘ 73| -1 98| 97 ✘ 34| 7 ✘ -1| 97 ✘ 97| 86 ✘ 7|120 ✘ 97| 95 ✘ \n", + " 86| 90 ✘ 120| 49 ✘ 95| 89 ✘ 90| 83 ✘ 49| -1 89| 84 ✘ 83|117 ✘ 19| 92 ✘ \n", + " 84|119 ✘ 117| 16 ✘ 92| 45 ✘ 119| 23 ✘ 16| 16 ✔ 45|111 ✘ 23| 9 ✘ 16| 89 ✘ \n", + "111| 18 ✘ 9| 36 ✘ 89| 2 ✘ 18|115 ✘ 36| 40 ✘ 2|100 ✘ 115|105 ✘ 40| 93 ✘ \n", + "100| 85 ✘ 105|107 ✘ 93| 90 ✘ 85| 62 ✘ 107|116 ✘ 90| 42 ✘ 62|123 ✘ 116| 40 ✘ \n", + " 42| -1 123| 77 ✘ 40| 40 ✔ -1| 57 ✘ 77|110 ✘ 40| 29 ✘ 57| 94 ✘ 110| 1 ✘ \n", + " 29| 29 ✔ 94| 71 ✘ 1|119 ✘ 29| 15 ✘ 71|115 ✘ 119| -1 15| -1 115| 50 ✘ \n", + "120| 71 ✘ 70| 50 ✘ 50| 61 ✘ 71| 38 ✘ 50| 4 ✘ 61| 3 ✘ 38|124 ✘ 4| 95 ✘ \n", + " 3| 27 ✘ 124| 64 ✘ 95|116 ✘ 27| 3 ✘ 48| 63 ✘ 116| 19 ✘ 3| 79 ✘ 63| 2 ✘ \n", + " 19| 43 ✘ 79| 92 ✘ 2| 8 ✘ 43| 65 ✘ 92| 35 ✘ 8| 30 ✘ 65| 73 ✘ 35| -1 \n", + " 30| 38 ✘ 73| 58 ✘ 73| 49 ✘ 38| 45 ✘ 58| -1 49| 46 ✘ 45|116 ✘ 58|101 ✘ \n", + " 46| 5 ✘ 116| 78 ✘ 101|126 ✘ 5| 76 ✘ 78|108 ✘ 126| 59 ✘ 105| 46 ✘ 108| 27 ✘ \n", + " 59| 14 ✘ 46| 57 ✘ 27| 81 ✘ 14| 3 ✘ 57| 9 ✘ 81|126 ✘ 3| 55 ✘ 9| 76 ✘ \n", + "126|101 ✘ 18|124 ✘ 76| 4 ✘ 101| 3 ✘ 124|102 ✘ 4| 79 ✘ 3| -1 102|103 ✘ \n", + " 79| 92 ✘ 121| 30 ✘ 103| 4 ✘ 92|103 ✘ 30| 48 ✘ 4| -1 103| -1 59| -1 \n", + "Symbol error rate e=0.0859375\n", + "maximum bitrate r=308.49609375 b/h\n", + "nbits=6 ampl=0.00387 seed=cbb3b8cf > ser=0.08594\n" + ] + } + ], + "source": [ + "fig, ax = plt.subplots(figsize=(12, 9))\n", + "\n", + "params = dict(default_params)\n", + "params['signal_amplitude'] = 2.0e-3\n", + "params['nbits'] = 6\n", + "seed = 0xcbb3b8cf\n", + "ser, br = run_ser_test(**params, sample_duration=sample_duration, print=print, seed=seed, ax=ax)\n", + "print(f'nbits={nbits} ampl={v:>.5f} seed={seed:08x} > ser={ser:.5f}')" + ] } ], "metadata": { diff --git a/lab-windows/dsss_experiments.ipynb b/lab-windows/dsss_experiments.ipynb index f2bbc0b..ee35464 100644 --- a/lab-windows/dsss_experiments.ipynb +++ b/lab-windows/dsss_experiments.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -75,13 +75,13 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "01394154cc52483e9d4483f1178d94c3", + "model_id": "5081f9508a894fcf810e2d9c92c24a3e", "version_major": 2, "version_minor": 0 }, @@ -102,10 +102,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -117,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -133,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -157,7 +157,7 @@ " -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1])" ] }, - "execution_count": 7, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -178,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -209,7 +209,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "182fd5ac86e74ad299a67e5f1d0b2b2b", + "model_id": "ec8de5680ba541938b7d1843b841c327", "version_major": 2, "version_minor": 0 }, @@ -230,10 +230,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 9, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -260,13 +260,13 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4cb2661eebb84478b06d285166ec13bc", + "model_id": "bb32b5050ee14ddc8eb64697a8eb774b", "version_major": 2, "version_minor": 0 }, @@ -288,10 +288,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 10, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -317,7 +317,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -330,7 +330,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "a2e2f747193b478bbfa792a0995ad4ed", + "model_id": "48b3ae259e8046a5b90a82c4e80bab2e", "version_major": 2, "version_minor": 0 }, @@ -352,10 +352,10 @@ { "data": { "text/plain": [ - "(2.0, 1.0234353995297893)" + "(2.0, 1.0121324810255907)" ] }, - "execution_count": 11, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -399,7 +399,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -419,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -430,18 +430,10 @@ "(63,) (63,)\n" ] }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":33: 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, ((ax1, ax3), (ax2, ax4)) = plt.subplots(2, 2, figsize=(16, 9))\n" - ] - }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "10aa67d294304f2ba26c8e6d5555d5e6", + "model_id": "73f4caf6a80f448183c41b711412a471", "version_major": 2, "version_minor": 0 }, @@ -455,10 +447,10 @@ { "data": { "text/plain": [ - "(0.002, 0.014074279)" + "(0.0020000000000000005, 0.014544699)" ] }, - "execution_count": 145, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -470,7 +462,7 @@ "\n", "#test_data = np.random.randint(0, 2, 100)\n", "#test_data = np.array([0, 1, 0, 0, 1, 1, 1, 0])\n", - "test_data = np.random.RandomState(seed=0).randint(0, 2 * (2**nbits), 64)\n", + "test_data = np.random.RandomState(seed=0xcbb3b8cf).randint(0, 2 * (2**nbits), 128)\n", "#test_data = np.random.RandomState(seed=0).randint(0, 8, 64)\n", "#test_data = np.array(list(range(8)) * 8)\n", "#test_data = np.array([0, 1] * 32)\n", @@ -542,13 +534,13 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c08b2a1dbdef429eb22b598bd3dc0146", + "model_id": "9fa8fa6a6837412da95630c634a12e21", "version_major": 2, "version_minor": 0 }, @@ -569,10 +561,10 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 14, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -592,13 +584,13 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "20117316e02548a99386c39e45e71ef1", + "model_id": "854dec05e45340ae91cf271b2facd7ed", "version_major": 2, "version_minor": 0 }, @@ -623,7 +615,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0msosh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbutter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'highpass'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'sos'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecimation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0msosl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbutter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'lowpass'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'sos'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecimation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mcor2_pe_flt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosh\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcor2_pe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0mcor2_pe_flt2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosh\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfiltfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcor2_pe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0msosh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbutter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'highpass'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'sos'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecimation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0msosl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbutter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'lowpass'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'sos'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdecimation\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mcor2_pe_flt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosh\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcor2_pe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0mcor2_pe_flt2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosh\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msosfiltfilt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msosl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcor2_pe\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mNameError\u001b[0m: name 'cor2_pe' is not defined" ] } @@ -650,21 +642,13 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 25, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":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()\n" - ] - }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "25fe274dea83415491fd7f86d38188d7", + "model_id": "b3f68635d3ad4863b990c0b6e742840b", "version_major": 2, "version_minor": 0 }, @@ -678,10 +662,10 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 57, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -695,21 +679,13 @@ }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 28, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - ":11: 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, (ax1, ax3) = plt.subplots(2, figsize=(12, 5))\n" - ] - }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "509bf67d93b74741b48bca58529c4b9d", + "model_id": "e6e78aec5f92465fbda1d231f7123196", "version_major": 2, "version_minor": 0 }, @@ -724,22 +700,30 @@ "name": "stdout", "output_type": "stream", "text": [ - "cor_an (65, 40949)\n", - "cwt_res (65, 40949)\n", - "th (65, 40949)\n", + "cor_an (65, 81269)\n", + "cwt_res (65, 81269)\n", + "th (65, 81269)\n", "[((65,), (65,)), ((65,), (65,)), ((65,), (65,)), ((65,), (65,)), ((65,), (65,))]\n", - "peaks: 982\n", - "avg_peak 1.6673786030736735\n", - "skipped 2 symbols at 30238.5\n", + "peaks: 1852\n", + "avg_peak 1.6610203317347632\n", + "skipped 3 symbols at 42209.0\n", "decoding [ref|dec]:\n", - " 44| 44 ✔ 47| 47 ✔ 117|117 ✔ 64| 64 ✔ 67| 67 ✔ 123|123 ✔ 67| 67 ✔ 103|103 ✔ \n", - " 9| 9 ✔ 83| 83 ✔ 21| 21 ✔ 114|114 ✔ 36| 36 ✔ 87| 87 ✔ 70| 70 ✔ 88| 88 ✔ \n", - " 88| 88 ✔ 12| 12 ✔ 58| 58 ✔ 65| 65 ✔ 102|102 ✔ 39| 39 ✔ 87| 87 ✔ 46| 46 ✔ \n", - " 88| 88 ✔ 81| 81 ✔ 37| 37 ✔ 25| 25 ✔ 77| 77 ✔ 72| 72 ✔ 9| 9 ✔ 20| 20 ✔ \n", - "115|115 ✔ 80| 80 ✔ 115|115 ✔ 69| 69 ✔ 126|126 ✔ 79| 79 ✔ 47| 47 ✔ 64| 64 ✔ \n", - " 82| 82 ✔ 99| 99 ✔ 88| 88 ✔ 49| 49 ✔ 115|115 ✔ 29| 29 ✔ 19| -1 19| 19 ✔ \n", - " 14| 14 ✔ 39| 39 ✔ 32| 32 ✔ 65| 64 ✘ 9| 9 ✔ 57| 57 ✔ 127|127 ✔ 32| 32 ✔ \n", - " 31| 31 ✔ 74| 74 ✔ 116|116 ✔ 23| 23 ✔ 35| 35 ✔ 126|126 ✔ 75| 75 ✔ 114| 26 ✘ \n", + " 10| 10 ✔ 69| 69 ✔ 124|124 ✔ 102|102 ✔ 2| 2 ✔ 3| 3 ✔ 78| 78 ✔ 29| 29 ✔ \n", + "122|123 ✘ 73| 73 ✔ 98| 98 ✔ 34| 34 ✔ -1| -1 ✔ 97| 97 ✔ 7| 7 ✔ 97| 97 ✔ \n", + " 86| 86 ✔ 120|120 ✔ 95| 95 ✔ 90| 90 ✔ 49| 49 ✔ 89| 89 ✔ 83| 83 ✔ 19| 19 ✔ \n", + " 84| 84 ✔ 117|117 ✔ 92| 92 ✔ 119|119 ✔ 16| 16 ✔ 45| 45 ✔ 23| 23 ✔ 16| 16 ✔ \n", + "111|111 ✔ 9| 9 ✔ 89| 89 ✔ 18| 18 ✔ 36| 36 ✔ 2| 2 ✔ 115|115 ✔ 40| 40 ✔ \n", + "100|100 ✔ 105|105 ✔ 93| 93 ✔ 85| 85 ✔ 107|107 ✔ 90| 90 ✔ 62| 62 ✔ 116|116 ✔ \n", + " 42| 42 ✔ 123|123 ✔ 40| 40 ✔ -1| -1 ✔ 77| 77 ✔ 40| 40 ✔ 57| 57 ✔ 110|110 ✔ \n", + " 29| 29 ✔ 94| 94 ✔ 1| 1 ✔ 29| 29 ✔ 71| 71 ✔ 119|119 ✔ 15| 15 ✔ 115|115 ✔ \n", + "120| -1 70| -1 50| 50 ✔ 71| 71 ✔ 50| 50 ✔ 61| 61 ✔ 38| 38 ✔ 4| 4 ✔ \n", + " 3| 3 ✔ 124|124 ✔ 95| 95 ✔ 27| 27 ✔ 48| 48 ✔ 116|116 ✔ 3| 3 ✔ 63| 63 ✔ \n", + " 19| 19 ✔ 79| 79 ✔ 2| 2 ✔ 43| 43 ✔ 92| 92 ✔ 8| 8 ✔ 65| 65 ✔ 35| 35 ✔ \n", + " 30| 30 ✔ 73| 73 ✔ 73| 73 ✔ 38| 38 ✔ 58| 58 ✔ 49| 49 ✔ 45| 45 ✔ 58| 58 ✔ \n", + " 46| 46 ✔ 116|116 ✔ 101|101 ✔ 5| 5 ✔ 78| 78 ✔ 126|126 ✔ 105| 76 ✘ 108|108 ✔ \n", + " 59| 59 ✔ 46| 46 ✔ 27| 27 ✔ 14| 14 ✔ 57| 57 ✔ 81| 81 ✔ 3| 3 ✔ 9| 9 ✔ \n", + "126|126 ✔ 18| 55 ✘ 76| 76 ✔ 101|101 ✔ 124|124 ✔ 4| 4 ✔ 3| 3 ✔ 102|102 ✔ \n", + " 79| 79 ✔ 121|121 ✔ 103|103 ✔ 92| 92 ✔ 30| 30 ✔ 4| 4 ✔ 103|103 ✔ 59| 58 ✘ \n", "Symbol error rate e=0.046875\n", "maximum bitrate r=321.6796875 b/h\n" ] @@ -896,34 +880,9 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "987be038c1b34e6e9509f7f224bbb620", - "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" - }, - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "fig, axs = plt.subplots(2, 1, figsize=(9, 7))\n", "fig.tight_layout()\n", -- cgit