From 55ebbcbdbc6d9513012a60a143c92eddb90f631d Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 6 Mar 2020 12:39:21 +0100 Subject: Finish DSSS demodulation stage 1 --- lab-windows/scratch.ipynb | 103 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 5 deletions(-) (limited to 'lab-windows') diff --git a/lab-windows/scratch.ipynb b/lab-windows/scratch.ipynb index 671bedf..ddd2455 100644 --- a/lab-windows/scratch.ipynb +++ b/lab-windows/scratch.ipynb @@ -2,11 +2,12 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "import json\n", + "import csv\n", "\n", "import numpy as np\n", "from matplotlib import pyplot as plt\n", @@ -17,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -170,13 +171,105 @@ "source": [ "sig.butter(8, 20e-3, output='sos', fs=10.0)" ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "655ce5c77d2a4047905245df39a095b0", + "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": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fig, ax = plt.subplots()\n", + "ax.plot([0-0.00012937261, 0-0.00022784119 , 0-0.00039295876 , 0-0.00066361829 , 00-0.0010971602 , 00-0.0017754816 ,\n", + " 00-0.0028116399 , 00-0.0043560231 , 00-0.0066005666 , 00-0.0097788338 , 000-0.014159188 , 000-0.020027947 ,\n", + " 000-0.027659611 , 000-0.037272236 , 000-0.048968014 , 0000-0.06266222 , 0000-0.07800759 , 000-0.094325546 ,\n", + " 0000-0.11055938 , 0000-0.12526666 , 0000-0.13666715 , 0000-0.14275811 , 0000-0.14149973 , 00000-0.1310612 ,\n", + " 0000-0.11010384 , 000-0.078063987 , 000-0.035389599 , 00000.016317957 , 00000.074297836 , 000000.13478363 ,\n", + " 000000.19331697 , 000000.24519242 , 000000.28597909 , 000000.31204596 , 000000.32101141 , 000000.31204596 ,\n", + " 000000.28597909 , 000000.24519242 , 000000.19331697 , 000000.13478363 , 00000.074297836 , 00000.016317957 ,\n", + " 000-0.035389599 , 000-0.078063987 , 0000-0.11010384 , 00000-0.1310612 , 0000-0.14149973 , 0000-0.14275811 ,\n", + " 0000-0.13666715 , 0000-0.12526666 , 0000-0.11055938 , 000-0.094325546 , 0000-0.07800759 , 0000-0.06266222 ,\n", + " 000-0.048968014 , 000-0.037272236 , 000-0.027659611 , 000-0.020027947 , 000-0.014159188 , 00-0.0097788338 ,\n", + " 00-0.0066005666 , 00-0.0043560231 , 00-0.0028116399 , 00-0.0017754816 , 00-0.0010971602 , 0-0.00066361829 ,\n", + " 0-0.00039295876 , 0-0.00022784119 , 0-0.00012937261 ])" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "data = np.genfromtxt('/tmp/foo.csv', delimiter=',')[1000:]" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "7c771472882e4ceeb8aeddfa5c08ca17", + "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, figsize=(15, 9), sharex=True)\n", + "axs = axs.flatten()\n", + "axs[0].set_title('corr')\n", + "axs[1].set_title('cwt')\n", + "#axs[2].set_title('iir')\n", + "\n", + "axs[0].plot(data[:,0], label='corr')\n", + "axs[1].plot(data[:,1], label='cwt')\n", + "axs[0].plot(data[:,2], label='avg')\n", + "axs[1].plot(data[:,2], label='avg')\n", + "\n", + "for ax in axs:\n", + " ax.legend()\n", + " ax.grid()" + ] } ], "metadata": { "kernelspec": { - "display_name": "winlabenv", + "display_name": "labenv", "language": "python", - "name": "winlabenv" + "name": "labenv" }, "language_info": { "codemirror_mode": { @@ -188,7 +281,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.8.1" } }, "nbformat": 4, -- cgit