From 834febb9aa0dac463f43914cb028be931f85de73 Mon Sep 17 00:00:00 2001 From: sara Date: Thu, 2 Dec 2021 20:02:16 +0100 Subject: =?UTF-8?q?BER=20Block=20erstellt,=20l=C3=A4uft=20noch=20nichtwie?= =?UTF-8?q?=20gew=C3=BCnscht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notebooks/BER .ipynb | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 notebooks/BER .ipynb (limited to 'notebooks/BER .ipynb') diff --git a/notebooks/BER .ipynb b/notebooks/BER .ipynb new file mode 100644 index 0000000..8e0a6f4 --- /dev/null +++ b/notebooks/BER .ipynb @@ -0,0 +1,171 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "ec5412d2", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np \n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "be1f0d01", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([0, 1])" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "byte1= np.array([0x12, 0xe3, 0x9b])\n", + "byte2 = np.array([0x12, 0xe3, 0x9c])\n", + "b1 = np.array([0,0])\n", + "b2 = np.array([0,1])\n", + "b1\n", + "b2" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c256a3d0", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0 0 7]\n" + ] + }, + { + "data": { + "text/plain": [ + "array([0, 1], dtype=uint8)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "v = byte1^byte2\n", + "v1 = np.array (v,dtype = np.uint8)\n", + "print(v1)\n", + "v2 = b1^b2\n", + "v2 = np.array (v2,dtype = np.uint8)\n", + "v2" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "227f0142", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1]\n" + ] + }, + { + "data": { + "text/plain": [ + "array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], dtype=uint8)" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "z = np.unpackbits(v1)\n", + "print(z)\n", + "z1 = np.unpackbits(v2)\n", + "z1" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "092d8dae", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = sum(z)\n", + "a" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0ac2e304", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "034142b6", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f203fbce", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} -- cgit v1.2.1 From cafce753722ec8d396cadfdf991b5c6f5a18dc12 Mon Sep 17 00:00:00 2001 From: sara Date: Fri, 3 Dec 2021 20:46:20 +0100 Subject: BER Block Fertig gestellt --- notebooks/BER .ipynb | 172 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 119 insertions(+), 53 deletions(-) (limited to 'notebooks/BER .ipynb') diff --git a/notebooks/BER .ipynb b/notebooks/BER .ipynb index 8e0a6f4..57675f1 100644 --- a/notebooks/BER .ipynb +++ b/notebooks/BER .ipynb @@ -15,47 +15,25 @@ "execution_count": 2, "id": "be1f0d01", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([0, 1])" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "byte1= np.array([0x12, 0xe3, 0x9b])\n", - "byte2 = np.array([0x12, 0xe3, 0x9c])\n", - "b1 = np.array([0,0])\n", - "b2 = np.array([0,1])\n", - "b1\n", - "b2" + "byte2 = np.array([0x12, 0xe3, 0x9c])\n" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "id": "c256a3d0", "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[0 0 7]\n" - ] - }, { "data": { "text/plain": [ - "array([0, 1], dtype=uint8)" + "array([0, 0, 7], dtype=uint8)" ] }, - "execution_count": 6, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -63,41 +41,32 @@ "source": [ "v = byte1^byte2\n", "v1 = np.array (v,dtype = np.uint8)\n", - "print(v1)\n", - "v2 = b1^b2\n", - "v2 = np.array (v2,dtype = np.uint8)\n", - "v2" + "v1" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "id": "227f0142", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1]\n" - ] - }, { "data": { "text/plain": [ - "array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], dtype=uint8)" + "array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,\n", + " 1, 1], dtype=uint8)" ] }, - "execution_count": 7, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "z = np.unpackbits(v1)\n", - "print(z)\n", - "z1 = np.unpackbits(v2)\n", - "z1" + "z" ] }, { @@ -123,26 +92,123 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "0ac2e304", + "cell_type": "markdown", + "id": "1551b295", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "# TEST Längenanpassung" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "034142b6", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "test_byte=np.array([31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3])\n", + "test_byte\n", + "vlen= 10 " + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "f203fbce", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(test_byte)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "fc4fef77", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "20" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "inp= ([31, 53,0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]+[30, 53,0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3])\n", + "len(inp)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "74ae964c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "v = test_byte^inp[:vlen]\n", + "v" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "5a1d95f1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n", + "[0 0 0 0 0 0 0 0 0 0]\n" + ] + } + ], + "source": [ + "for i in range(1,10):\n", + " v = test_byte^inp[:vlen]\n", + " print(v)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "038ceffa", + "metadata": {}, "outputs": [], "source": [] } -- cgit v1.2.1