summaryrefslogtreecommitdiff
path: root/lab-windows
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-09 13:23:35 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-09 13:23:35 +0100
commit9debe084fca8992efdf0f08bfed343de0987629e (patch)
tree8d7088f44752227eb9148c8f42842fb12a24335d /lab-windows
parentb4d5293d045d68822ad5b2d0a7a5f392c596a0ba (diff)
downloadmaster-thesis-9debe084fca8992efdf0f08bfed343de0987629e.tar.gz
master-thesis-9debe084fca8992efdf0f08bfed343de0987629e.tar.bz2
master-thesis-9debe084fca8992efdf0f08bfed343de0987629e.zip
demod wip
Diffstat (limited to 'lab-windows')
-rw-r--r--lab-windows/dsss_experiments-ber.ipynb126
1 files changed, 113 insertions, 13 deletions
diff --git a/lab-windows/dsss_experiments-ber.ipynb b/lab-windows/dsss_experiments-ber.ipynb
index 2d06233..c483cfc 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": 1,
+ "execution_count": 121,
"metadata": {},
"outputs": [],
"source": [
@@ -14,11 +14,11 @@
"from collections import defaultdict\n",
"import json\n",
"\n",
- "\n",
"from matplotlib import pyplot as plt\n",
"import matplotlib\n",
"import numpy as np\n",
"from scipy import signal as sig\n",
+ "from scipy import fftpack as fftpack\n",
"import ipywidgets\n",
"\n",
"from tqdm.notebook import tqdm\n",
@@ -29,7 +29,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 108,
"metadata": {},
"outputs": [],
"source": [
@@ -38,7 +38,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 109,
"metadata": {},
"outputs": [],
"source": [
@@ -47,7 +47,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 110,
"metadata": {},
"outputs": [],
"source": [
@@ -73,7 +73,7 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": 111,
"metadata": {},
"outputs": [],
"source": [
@@ -93,7 +93,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 112,
"metadata": {},
"outputs": [],
"source": [
@@ -107,7 +107,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 113,
"metadata": {},
"outputs": [
{
@@ -127,7 +127,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 114,
"metadata": {},
"outputs": [],
"source": [
@@ -142,7 +142,7 @@
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": 115,
"metadata": {},
"outputs": [],
"source": [
@@ -162,7 +162,67 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 125,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "4330b0f8ceea4d5d922d2063a81554ca",
+ "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()\n",
+ "ax.psd(colorednoise.powerlaw_psd_gaussian(1, 1000))\n",
+ "None"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 130,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "start 14880 end 24800 rec 29760\n"
+ ]
+ }
+ ],
+ "source": [
+ "test_duration = 32\n",
+ "test_nbits = 5\n",
+ "test_signal_amplitude=2.0e-3\n",
+ "test_decimation=10\n",
+ "test_signal_amplitude = 200e-3\n",
+ "noise_level = 10e-3\n",
+ "\n",
+ "#test_data = np.random.RandomState(seed=0).randint(0, 2 * (2**test_nbits), test_duration)\n",
+ "#test_data = np.array([0, 1, 2, 3] * 50)\n",
+ "test_data = np.array(range(test_duration))\n",
+ "signal = np.repeat(modulate(test_data, test_nbits, pad=False) * 2.0 - 1, test_decimation) * test_signal_amplitude\n",
+ "noise = colorednoise.powerlaw_psd_gaussian(1, len(signal)*3) * noise_level\n",
+ "noise[int(1.5*len(signal)):][:len(signal)] += signal\n",
+ "print('start', int(1.5*len(signal)), 'end', int(1.5*len(signal))+len(signal), 'rec', len(noise))\n",
+ "\n",
+ "with open(f'dsss_test_signals/dsss_test_noiseless_padded.bin', 'wb') as f:\n",
+ " for e in noise:\n",
+ " f.write(struct.pack('<f', e))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -176,13 +236,13 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "373401133cfe408aa15738e48c58dfaa",
+ "model_id": "",
"version_major": 2,
"version_minor": 0
},
@@ -200,6 +260,46 @@
},
{
"cell_type": "code",
+ "execution_count": 104,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "<ipython-input-104-abeb28a85dfa>:5: 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": "",
+ "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": [
+ "#nonlinear_distance_impl = lambda x: np.exp(-np.abs(x)/10) * x**4\n",
+ "nonlinear_distance_impl = lambda x: np.exp(-((x/10 - 0.5)%1 - 0.5)**2 / (2*1.2/10**2))\n",
+ "\n",
+ "def plot_distance_func_impl():\n",
+ " fig, ax = plt.subplots()\n",
+ " x = np.linspace(-30, 30, 10000)\n",
+ " ax.plot(x, nonlinear_distance_impl(x))\n",
+ "\n",
+ "plot_distance_func_impl()"
+ ]
+ },
+ {
+ "cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],