cleaned code, updated Readme plots
parent
2bc9cebfe1
commit
c22da6d352
|
@ -15,17 +15,10 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import pickle"
|
"import sys\n",
|
||||||
]
|
"\n",
|
||||||
},
|
"sys.path.append('../scripts')\n",
|
||||||
{
|
"import data_helper"
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 1,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"path = \"C:/Studium/dsa/data\"\n",
|
|
||||||
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\""
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -37,50 +30,31 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Reading SB\n",
|
|
||||||
"Length of SB: 50\n",
|
|
||||||
"Reading AFIB\n",
|
|
||||||
"Length of AFIB: 27\n",
|
|
||||||
"Reading GSVT\n",
|
"Reading GSVT\n",
|
||||||
"Length of GSVT: 0\n",
|
"Reading AFIB\n",
|
||||||
"Reading SR\n",
|
"Reading SR\n",
|
||||||
"Length of SR: 13\n"
|
"Reading SB\n",
|
||||||
|
"Number of patients per category:\n",
|
||||||
|
"GSVT: 1027\n",
|
||||||
|
"AFIB: 9787\n",
|
||||||
|
"SR: 10426\n",
|
||||||
|
"SB: 15826\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import pickle\n",
|
"data = data_helper.load_data(only_demographic=False)\n",
|
||||||
"from matplotlib import pyplot as plt\n",
|
|
||||||
"import wfdb\n",
|
|
||||||
"# read pickle files and check len and print first record and first record keys\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"#path = \"C:/Studium/dsa/data\"\n",
|
"print(\"Number of patients per category:\")\n",
|
||||||
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\"\n",
|
"for cat_name in data.keys():\n",
|
||||||
"path = \"C:/Users/klara/projects/DSA/data\"\n",
|
" print(f\"{cat_name}: {len(data[cat_name])}\")"
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"categories_dict = {\n",
|
|
||||||
"'SB': [426177001],\n",
|
|
||||||
"'AFIB': [164889003, 164890007],\n",
|
|
||||||
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
|
|
||||||
"'SR': [426783006, 427393009]\n",
|
|
||||||
"}\n",
|
|
||||||
"\n",
|
|
||||||
"\n",
|
|
||||||
"data = {}\n",
|
|
||||||
"for cat_name in categories_dict.keys():\n",
|
|
||||||
" print(f\"Reading {cat_name}\")\n",
|
|
||||||
" with open(f'{path}/{cat_name}.pkl', 'rb') as f:\n",
|
|
||||||
" records = pickle.load(f)\n",
|
|
||||||
" data[cat_name] = records\n",
|
|
||||||
" print(f\"Length of {cat_name}: {len(records)}\")"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -92,7 +66,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 5,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -146,7 +120,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.9"
|
"version": "3.10.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,14 +4,17 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Signal Processing\n",
|
"# Noise Reduction\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The notebook goes into more detail on the processing of the 12 ECG data per patient. First, the signal itself is considered and then the ECG signal processing methods integrated in the 'wfdb' module are explored. Various approaches are then used to normalize the data and reduce noise in order to make the signals as comparable as possible."
|
"This Notebook is used to reduce the noise in the ECG signals.\n",
|
||||||
|
"First a Butterworth filter is applied to the signals to remove the high frequency noise.\n",
|
||||||
|
"Than a loess filter is applied to the signals to remove the low frequency noise.\n",
|
||||||
|
"Last Non local means filter is applied to the signals to remove the remaining noise."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 40,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -40,21 +43,22 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 19,
|
"execution_count": 2,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Reading SB\n",
|
|
||||||
"Reading AFIB\n",
|
|
||||||
"Reading GSVT\n",
|
"Reading GSVT\n",
|
||||||
|
"Reading AFIB\n",
|
||||||
"Reading SR\n",
|
"Reading SR\n",
|
||||||
"SB: 16559\n",
|
"Reading SB\n",
|
||||||
"AFIB: 9839\n",
|
"Number of patients per category:\n",
|
||||||
"GSVT: 948\n",
|
"GSVT: 1027\n",
|
||||||
"SR: 9720\n"
|
"AFIB: 9787\n",
|
||||||
|
"SR: 10426\n",
|
||||||
|
"SB: 15826\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -68,7 +72,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 28,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -90,7 +94,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 41,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -116,7 +120,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 30,
|
"execution_count": 5,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -146,7 +150,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 31,
|
"execution_count": 6,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -176,7 +180,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 32,
|
"execution_count": 7,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -206,7 +210,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 33,
|
"execution_count": 8,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -236,7 +240,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 36,
|
"execution_count": 9,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
@ -256,7 +260,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 38,
|
"execution_count": 10,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 40 KiB |
Binary file not shown.
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 51 KiB |
Loading…
Reference in New Issue