summaryrefslogtreecommitdiff
path: root/lab-windows/dsss_experiments-ber.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'lab-windows/dsss_experiments-ber.ipynb')
-rw-r--r--lab-windows/dsss_experiments-ber.ipynb312
1 files changed, 240 insertions, 72 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": [
- "<ipython-input-84-f36c7b0ffb61>: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",
+ "<ipython-input-111-2589572e37aa>: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": [
- "<matplotlib.legend.Legend at 0x7fe2bdd64430>"
+ "<matplotlib.legend.Legend at 0x7fe3073ed0a0>"
]
},
- "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": [
+ "<ipython-input-101-d477d71c27f9>: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": {