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.ipynb24
1 files changed, 14 insertions, 10 deletions
diff --git a/lab-windows/dsss_experiments-ber.ipynb b/lab-windows/dsss_experiments-ber.ipynb
index 83a4a17..5d0de5f 100644
--- a/lab-windows/dsss_experiments-ber.ipynb
+++ b/lab-windows/dsss_experiments-ber.ipynb
@@ -73,11 +73,11 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
- "def modulate(data, nbits=5):\n",
+ "def modulate(data, nbits=5, pad=True):\n",
" # 0, 1 -> -1, 1\n",
" mask = np.array(gold(nbits))*2 - 1\n",
" \n",
@@ -85,7 +85,10 @@
" data_lsb_centered = ((data&1)*2 - 1)\n",
"\n",
" signal = (np.multiply(sel, np.tile(data_lsb_centered, (2**nbits-1, 1)).T).flatten() + 1) // 2\n",
- " return np.hstack([ np.zeros(len(mask)), signal, np.zeros(len(mask)) ])"
+ " if pad:\n",
+ " return np.hstack([ np.zeros(len(mask)), signal, np.zeros(len(mask)) ])\n",
+ " else:\n",
+ " return signal"
]
},
{
@@ -124,7 +127,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
@@ -139,18 +142,19 @@
},
{
"cell_type": "code",
- "execution_count": 73,
+ "execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
- "test_duration = 300\n",
+ "test_duration = 200\n",
"test_nbits = 5\n",
"test_signal_amplitude=2.0e-3\n",
"test_decimation=10\n",
"\n",
"for test_signal_amplitude in [2.0e-3, 20e-3, 200e-3, 2]:\n",
" test_data = np.random.RandomState(seed=0).randint(0, 2 * (2**test_nbits), test_duration)\n",
- " signal = np.repeat(modulate(test_data, test_nbits) * 2.0 - 1, test_decimation) * test_signal_amplitude\n",
+ " #test_data = np.array([0, 1, 2, 3] * 50)\n",
+ " signal = np.repeat(modulate(test_data, test_nbits, pad=False) * 2.0 - 1, test_decimation) * test_signal_amplitude\n",
" with open(f'dsss_test_signals/dsss_test_noiseless_{test_signal_amplitude*1000:.0f}mHz.bin', 'wb') as f:\n",
" for e in signal:\n",
" f.write(struct.pack('<f', e))"
@@ -1174,9 +1178,9 @@
],
"metadata": {
"kernelspec": {
- "display_name": "labenv",
+ "display_name": "winlabenv",
"language": "python",
- "name": "labenv"
+ "name": "winlabenv"
},
"language_info": {
"codemirror_mode": {
@@ -1188,7 +1192,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.1"
+ "version": "3.7.6"
}
},
"nbformat": 4,