DSA_SS24/notebooks/signal_processing.ipynb

346 lines
494 KiB
Plaintext
Raw Normal View History

2024-05-01 12:53:33 +02:00
{
"cells": [
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Signal Processing\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."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"from matplotlib import pyplot as plt\n",
"import wfdb.processing"
]
},
2024-05-01 12:53:33 +02:00
{
"cell_type": "code",
2024-05-15 20:20:01 +02:00
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"path = \"C:/Studium/dsa/data\"\n",
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load Data"
]
},
{
"cell_type": "code",
"execution_count": 20,
2024-05-01 12:53:33 +02:00
"metadata": {},
2024-05-07 20:16:12 +02:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading SB\n",
2024-05-15 20:20:01 +02:00
"Length of SB: 16559\n",
2024-05-07 20:16:12 +02:00
"Reading AFIB\n",
2024-05-15 20:20:01 +02:00
"Length of AFIB: 9839\n",
2024-05-07 20:16:12 +02:00
"Reading GSVT\n",
2024-05-15 20:20:01 +02:00
"Length of GSVT: 948\n",
2024-05-07 20:16:12 +02:00
"Reading SR\n",
2024-05-15 20:20:01 +02:00
"Length of SR: 9720\n"
2024-05-07 20:16:12 +02:00
]
}
],
2024-05-01 12:53:33 +02:00
"source": [
2024-05-15 20:20:01 +02:00
"\n",
2024-05-01 12:53:33 +02:00
"# read pickle files and check len and print first record and first record keys\n",
"\n",
2024-05-15 20:20:01 +02:00
"\n",
2024-05-01 12:53:33 +02:00
"\n",
2024-05-07 20:16:12 +02:00
"categories_dict = {\n",
2024-05-01 12:53:33 +02:00
"'SB': [426177001],\n",
"'AFIB': [164889003, 164890007],\n",
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
"'SR': [426783006, 427393009]\n",
"}\n",
"\n",
"\n",
"data = {}\n",
2024-05-07 20:16:12 +02:00
"for cat_name in categories_dict.keys():\n",
2024-05-01 12:53:33 +02:00
" print(f\"Reading {cat_name}\")\n",
2024-05-07 20:16:12 +02:00
" with open(f'{path}/{cat_name}.pkl', 'rb') as f:\n",
2024-05-01 12:53:33 +02:00
" records = pickle.load(f)\n",
" data[cat_name] = records\n",
" print(f\"Length of {cat_name}: {len(records)}\")"
]
2024-05-07 20:16:12 +02:00
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For a better understanding of the structure and dimensions of the individual data sets, there are printed."
]
},
2024-05-07 20:16:12 +02:00
{
"cell_type": "code",
2024-05-15 20:20:01 +02:00
"execution_count": 21,
2024-05-07 20:16:12 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Keys of first record of SB: dict_keys(['record_name', 'n_sig', 'fs', 'counter_freq', 'base_counter', 'sig_len', 'base_time', 'base_date', 'comments', 'sig_name', 'p_signal', 'd_signal', 'e_p_signal', 'e_d_signal', 'file_name', 'fmt', 'samps_per_frame', 'skew', 'byte_offset', 'adc_gain', 'baseline', 'units', 'adc_res', 'adc_zero', 'init_value', 'checksum', 'block_size'])\n",
"{'record_name': 'JS00002', 'n_sig': 12, 'fs': 500, 'counter_freq': None, 'base_counter': None, 'sig_len': 5000, 'base_time': None, 'base_date': None, 'comments': ['Age: 59', 'Sex: Female', 'Dx: 426177001,164934002', 'Rx: Unknown', 'Hx: Unknown', 'Sx: Unknown'], 'sig_name': ['I', 'II', 'III', 'aVR', 'aVL', 'aVF', 'V1', 'V2', 'V3', 'V4', 'V5', 'V6'], 'p_signal': array([[-0.01 , 0.01 , 0.02 , ..., 0.054, 0.049, 0. ],\n",
" [-0.024, -0.02 , 0.005, ..., 0.034, 0.034, -0.015],\n",
" [-0.02 , -0.02 , 0. , ..., 0.034, 0.034, -0.01 ],\n",
" ...,\n",
" [ 0.015, 0.01 , -0.005, ..., -0.015, -0.02 , 0.005],\n",
" [ 0.01 , 0.01 , 0. , ..., -0.02 , -0.024, 0. ],\n",
2024-05-08 08:26:31 +02:00
" [ 0.01 , 0.01 , 0. , ..., -0.024, -0.029, -0.005]]), 'd_signal': None, 'e_p_signal': None, 'e_d_signal': None, 'file_name': ['JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat', 'JS00002.mat'], 'fmt': ['16', '16', '16', '16', '16', '16', '16', '16', '16', '16', '16', '16'], 'samps_per_frame': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'skew': [None, None, None, None, None, None, None, None, None, None, None, None], 'byte_offset': [24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24], 'adc_gain': [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0], 'baseline': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'units': ['mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV', 'mV'], 'adc_res': [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], 'adc_zero': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'init_value': [-10, 10, 20, 0, -15, 15, -10, -54, 63, 54, 49, 0], 'checksum': [12346, 26962, 14528, -13537, -6991, 14569, -383, 16468, -29512, -7548, -22267, 31542], 'block_size': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}\n",
"(5000, 12)\n"
2024-05-07 20:16:12 +02:00
]
}
],
"source": [
"# print keys of first record\n",
"print(f\"Keys of first record of SB: {data['SB'][0].__dict__.keys()}\")\n",
2024-05-15 20:20:01 +02:00
"print(data['SB'][0].__dict__)\n",
"print(data['SB'][0].__dict__['p_signal'].shape)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of records with p_signal: 9720\n",
"Number of records with e_p_signal: 0\n",
"Number of records with d_signal: 0\n",
"Number of records with e_d_signal: 0\n"
]
}
],
"source": [
"# count how many different signals are available\n",
2024-05-07 20:16:12 +02:00
"counter_p = 0\n",
"counter_e_p = 0\n",
"counter_d = 0\n",
"counter_e_d = 0\n",
"for record in data['SR']:\n",
" if record.p_signal is not None:\n",
" counter_p += 1\n",
" if record.e_p_signal is not None:\n",
" counter_e_p += 1\n",
" if record.d_signal is not None:\n",
" counter_d += 1\n",
"\n",
"print(f\"Number of records with p_signal: {counter_p}\")\n",
"print(f\"Number of records with e_p_signal: {counter_e_p}\")\n",
"print(f\"Number of records with d_signal: {counter_d}\")\n",
2024-05-15 20:20:01 +02:00
"print(f\"Number of records with e_d_signal: {counter_e_d}\")"
2024-05-08 08:26:31 +02:00
]
},
{
"cell_type": "code",
2024-05-15 20:20:01 +02:00
"execution_count": 23,
2024-05-08 08:26:31 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAksAAAHHCAYAAACvJxw8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydd1xT1xfAv0nYe6MgCogLB05w761Va7XWDmfbX7W2tbZaba2j1tVa27qqHa5a667WvbXuvTcKCrIEZENCkvf7AwkJMyAQou/7+eQD7+a9l3PfuPfcc849VyIIgoCIiIiIiIiIiEi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JDvvtlKdX68/vrrtGnThn/++Yd9+/bx/fffM3fuXLZs2UKPHj0KPE5EpDQRlSURESNErVYzbNgw7OzsGDt2LLNmzWLAgAH0799fs8+mTZvw9fVly5YtOlaPqVOnlolMwcHBCIKg81t3794FsmZN5Ue268jOzo7OnTuXmizVqlXjzp07ecpv376t+b4kbN68GQsLC/bu3Yu5ubmmfMWKFSUTNB969+7Nr7/+yqlTp2jRokWpnXfTpk0MHTqUH374QVOWkZFBQkJCqf1GQVSvXp2UlJQS3+PKlSszevRoRo8eTUxMDI0bN2bmzJmisiRSbogxSyIiRsj8+fM5efIkv/76KzNmzKBly5aMGjWK2NhYzT7ZI37tEf6ZM2c4depUmcgUERHBP//8o9lOSkpi9erVNGzYMF8XHECTJk2oXr068+bNIyUlJc/
2024-05-08 08:26:31 +02:00
"text/plain": [
"<Figure size 640x480 with 12 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
2024-05-15 20:20:01 +02:00
}
],
"source": [
"#Plot a complete Record\n",
"wfdb.plot_wfdb(data['SB'][24],title=\"Example for all Channels\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
2024-05-08 08:26:31 +02:00
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABN0AAAGJCAYAAAC+dUXNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADoxklEQVR4nOydd5wT1frGnyRb2QYssHSWKh0UBEHBhoIg9u5V8FquBcv1p1exgIqCvVzFy7VgV7z2AoKKYANEQZDel76N7btsS+b3RzKTmckkmzKT7Eye7+fjx+xkkjnL2TNzznue93ltgiAIIIQQQgghhBBCCCGE6IY91g0ghBBCCCGEEEIIIcRqMOhGCCGEEEIIIYQQQojOMOhGCCGEEEIIIYQQQojOMOhGCCGEEEIIIYQQQ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kk09w8skno3Pnzrp8JyGEEEKiD4NuhBBCCDE15eXlKC4uVvx35MgR6f0HHngAQ4cOxbXXXovKykoAwJIlS/Dqq69ixowZGDJkCACgoqICr732Gk455RQ88cQTeOihh1BUVITx48dj3bp1Ptd977338PLLL+PWW2/F//3f/+HHH3/EJZdcggceeACLFy/GPffcgxtuuAFfffWVZirnjh07cOmll+Kss87CnDlzkJCQgIsvvhjfffddwN/3hx9+wNixY1FRUYGZM2di9uzZKCsrw2mnnYbVq1f7/dzYsWOlNMYzzjgD77zzjvRzQUEBRo8ejSVLluDmm2/GY489htraWpxzzjn47LPPfL5r1qxZWLhwIe666y7Mnj0bSUlJmtf88ssvAQBXXXVVwN9JjtPpxPjx45GdnY2nn34aJ598Mp555hm88sorivNeeOEFHHvssXjkkUcwe/Zs6d9PHSgEgF9++QU333wzLrvsMjz55JOora3FhRdeqPg7EbnkkktQWVmJOXPm4JJLLsGbb76Jhx9+WHHOY489hquvvhq9e/fGs88+izvuuANLly7F2LFjUVZWFvTv6o9FixahrKwMV155ZcTfRQghhJAYIhBCCCGEmJA33nhDAKD5X3JysuLcDRs2CElJScJ1110nlJaWCp06dRKGDx8uNDQ0SOc0NjYKdXV1is+VlpYKOTk5wt///nfp2J49ewQAQtu2bYWysjLp+PTp0wUAwpAhQxTfe/nllwtJSUlCbW2tdKxbt24CAOGTTz6RjpWXlwsdOnQQjj32WOnYsmXLBADCsmXLBEEQBJfLJfTu3VsYP3684HK5pPNqamqE7t27C2eccUaT/24AhFtuuUVx7I477hAACD///LN0rLKyUujevbuQm5srOJ1ORXt69Ogh1NTUNHmt888/XwAglJaWNnmuIAjClClTBADCI488ojh+7LHHCsOGDVMcU1+/vr5eGDhwoHDaaacpjgMQkpKShJ07d0rH1q9fLwAQXnzxRenYzJkzBQCKvhZ/h+zsbOnnvLw8weFwCI899pjivA0bNggJCQmK41OmTBG6desWxG+u5MILLxSSk5OD/ncjhBBCSPOESjdCCCGEmJq5c+fiu+++U/z3zTffKM4ZOHAgHn74Ybz22msYP348iouL8dZbbyEhwWtv63A4JMWWy+VCSUkJGhsbMXz4cKxdu9bnuhdffDGysrKkn0eOHAnA7c8l/96RI0eivr4eBw8eVHy+Y8eOOP/886WfMzMzcfXVV+PPP/9Efn6+5u+6bt067NixA1dccQWOHDkiKfuqq6tx+umn46effoLL5Qr2n05i0aJFGDFiBE466STpWHp6Om644Qbk5eVh8+bNivOnTJmC1NTUJr9XTDvNyMgIqT033nij4ucxY8Zg9+7dimPy65eWlqK8vBxjxozR7Ktx48ahZ8+e0s+DBw9GZmamz3f6u/aRI0ek3+XTTz+Fy+XCJZdcolBXtm/fHr179/ZJRw6ViooKLFy4EBMnTtTVe48QQggh0YeFFAghhBBiakaMGBFUIYW7774bCxYswOrVqzF79mz079/f55y33noLzzzzDLZu3YqGhgbpuFZ11K5duyp+FgNwXbp00TxeWlqqON6rVy+FpxoA9OnTB4DbN659+/Y+19yxYwcAd9DLH+Xl5WjVqpXf97XYu3evFDSU069fP+n9gQMHSse1/j20yMzMBABUVlYGHUBKSUlB27ZtFcdatWrl8+/39ddf49FHH8W6detQV1cnHVf/mwK+feXvO7XOFf8tS0tLkZmZiR07dkAQBPTu3Vuz/YmJiX5+s+D45JNPUFtby9RSQgghxAIw6EYIIYSQuGD37t1S0GrDhg0+77/77ruYOnUqzjvvPNx9991o164dHA4H5syZg127dvmc73A4NK/j77ggCBG03o2oYnvqqacwdOhQzXPS09Mjvk5TBKNyA4C+ffsCcP97jxkzJqjP+Pv3k/Pzzz/jnHPOwdixY/Hyyy+jQ4cOSExMxBtvvIH3338/6O/U6pOmznW5XLDZbPjmm280z4303/+9995DVlYWzj777Ii+hxBCCCGxh0E3QgghhFgel8uFqVOnIjMzE3fccQdmz56Niy66CBdccIF0zscff4wePXrg008/VailZs6caUibdu7cCUEQFNfavn07AHd1Uy3EFMnMzEyMGzdOt7Z069YN27Zt8zm+detW6f1wmDx5MubMmYN333036KBbMHzyySdISUnBkiVLkJycLB1/4403dLuGP3r27AlBENC9e3dJmagXhw8fxrJlyzB16lTF70UIIYQQc0JPN0IIIYRYnmeffRYrVqzAK6+8glmzZmH06NG46aabUFxcLJ0jqpbk6qfffvsNK1euNKRNhw4dUlQGraiowNtvv42hQ4dqppYCwLBhw9CzZ088/fTTqKqq8nm/qKgorLZMnDgRq1evVvyu1dXVeOWVV5Cbm6uZihsMo0aNwoQJE/Daa6/h888/93m/vr5es7JrUzgcDthsNjidTulYXl6e5jX05oILLoDD4cDDDz/
2024-05-08 08:26:31 +02:00
"text/plain": [
"<Figure size 1500x400 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
2024-05-15 20:20:01 +02:00
}
],
"source": [
"#Plot specific Channel of Record\n",
"fig = wfdb.plot_items(data['SB'][24].p_signal[:,0],title=\"Example for Channel 7\",figsize=(15,4),return_fig=True)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"#Find peaks in Channel 6 of Record 25\n",
"hard = wfdb.processing.find_local_peaks(data['SB'][24].p_signal[:,6],radius=3)\n",
"record = data['SB'][24].p_signal[:,6]\n",
"wholeRecord = data['SB'][24]\n",
"peak_points_y = [record[i] for i in hard] "
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
2024-05-08 08:26:31 +02:00
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2IAAAHWCAYAAAAVazrYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADadElEQVR4nOydd3wT9f/HX5d0t5RuCpQhG0SGIFP2tCpiRYZ83YIiiAiI4k9UtrJkOEHBhYBg3cgUBBVRUQRlqAgyC7SFltKR5HK/Py53ubvcJXdp2oy+n49HH20ul+STTz/rvRmO4zgQBEEQBEEQBEEQlYbJ3w0gCIIgCIIgCIKoap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gs+OGHH7Bu3TrUr18f999/v+Zrp0yZgg8++AD9+vXDY489htjYWLz11luoW7cu8vPzvbIi3XLLLZgxYwbuv/9+dOnSBQcPHsTq1avRoEEDr7+jIGQdPXoUc+bMEa93794dX3/9NSIjI3HDDTe4fY/o6Gi0aNEC69atQ5MmTZCUlISWLVuiZcuWXrfLCE8++SQ+//xz3HLLLbjvvvvQrl07XL16FQcPHsSGDRtw4sQJpKSk4Oabb8aiRYswcOBA3HXXXbhw4QJeffVVNGrUCAcOHNB8/06dOuGzzz5DZmYmhgwZgk8//RTh4eHo378/0tPT0bVrV9SoUQOHDx/GK6+8gptvvtnFckYQBFGVIYsYQRAEYYgFCxagV69e2LhxIyZ
2024-05-08 08:26:31 +02:00
"text/plain": [
"<Figure size 1000x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(10, 5))\n",
"plt.plot(record)\n",
"plt.plot(hard, peak_points_y, 'ro', label='Peaks')\n",
"plt.xlabel('Time')\n",
"plt.ylabel('Amplitude')\n",
"plt.title('Signal with Peaks')\n",
"plt.legend()\n",
"plt.grid(True)\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-05-15 20:20:01 +02:00
"execution_count": 27,
2024-05-08 08:26:31 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Learning initial signal parameters...\n",
"Failed to find 8 beats during learning.\n",
"Initializing using default parameters\n",
"Running QRS detection...\n",
"QRS detection complete.\n",
"[ 484 1038 1590 2131 2675 3219 3758 4300 4838]\n"
]
}
],
"source": [
2024-05-15 20:20:01 +02:00
"# Normalize data by setting qrs peaks to index position 0 (“X-axis normalization”)\n",
2024-05-08 08:26:31 +02:00
"indicies = wfdb.processing.xqrs_detect(wholeRecord.p_signal[:,6],wholeRecord.fs,0,5000)\n",
"print(indicies)"
]
},
{
"cell_type": "code",
2024-05-15 20:20:01 +02:00
"execution_count": 28,
2024-05-08 08:26:31 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-05-15 20:20:01 +02:00
"For normalization: [0.059 0.068 0.083 ... 0.068 0.063 0.049]\n",
"After normalization: [0.27931363 0.28789323 0.30219256 ... 0.28789323 0.28312679 0.26978074]\n"
2024-05-08 08:26:31 +02:00
]
2024-05-15 20:20:01 +02:00
}
],
"source": [
"# Normalization through upper and lower bounds (“Y-axis normalization”)\n",
"print(\"For normalization: \", wholeRecord.p_signal[:,0])\n",
"wholeRecord.p_signal[:,0] = wfdb.processing.normalize_bound(wholeRecord.p_signal[:,0],0,1)\n",
"print(\"After normalization: \",wholeRecord.p_signal[:,0])\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
2024-05-08 08:26:31 +02:00
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAksAAAHHCAYAAACvJxw8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydd3xT1RfAv0m69y50QFvKKqPMlr03yBJkqEz1J4iKqAiKBUSWIiII4mKpyBYEZMiUvfcutFBa2tKW7jZpkvf7ozRNOtPSNg287+eTT/tu3ns59417zz3n3HMlgiAIiIiIiIiIiIiIFIjU0AKIiIiIiIiIiFRmRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRERERERERKQIRGVJRESkwjh06BASiYRDhw6V2TljYmIYNGgQzs7OSCQSFi1aVGbnfhZ8fHwYNWqUZrs86g4gkUiYMGFCmZ7TkEgkEmbMmGFoMUREdBCVJRGRSsKqVauQSCSFfk6ePGloESslH3zwAXv27GHq1Kn89ttv9OjRw9AilQl3797lf//7H35+flhYWGBnZ0fr1q357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xen2SdnxK89wj916hQnTpwoF5mioqL466+/NNvJycmsWbOGRo0aFeiCA2jatCk1atRgwYIFpKam5vs
2024-05-08 08:26:31 +02:00
"text/plain": [
"<Figure size 640x480 with 12 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
2024-05-15 20:20:01 +02:00
}
],
"source": [
"wfdb.plot_wfdb(wholeRecord,title=\"Example for all Channels\")\n"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
2024-05-08 08:26:31 +02:00
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNEAAAGJCAYAAACkSaVDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADly0lEQVR4nOydd5gUVdrFT3dPzsQhM+QgUZKgoCiKqBjXvAbWrBjXxKeCEcy6a1jMGTHruiCoCIqCIBnJCEOeGSYwkUnd9f3RXdWVejpW91T1+T0PD93Voe7Mnbp173vPe16bIAgCCCGEEEIIIYQQQgghPrHHugGEEEIIIYQQQgghhDR3GEQjhBBCCCGEEEIIIcQPDKIRQgghhBBCCCGEEOIHBtEIIYQQQgghhBBCCPEDg2iEEEIIIYQQQgghhPiBQTRCCCGEEEIIIYQQQvzAIBohhBBCCCGEEEIIIX5gEI0QQgghhBBCCCGEED8wiEYIIYQQQgghhBBCiB8YRCOEEEIIiRJLliyBzWbDkiVLIvadhYWF+Nvf/oZWrVrBZrPhxRdfjNh3h8vVV1+NjIyMWDcjYlx99dXIy8uLdTMIIYQQEiMYRCOEEEJIs+Ddd9+FzWbz+e/333+PdRObJXfeeScWLlyIadOm4YMPPsDpp59u+Dlra2vxwgsvYNSoUcjOzkZKSgp69+6NqVOnYvv27Yafv7mzcuVK3HzzzRg2bBgSExNhs9li3SRCCCGERICEWDeAEEIIIUTOo48+im7dummO9+zZMwata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MIC99xzD+bOnYuVK1di5syZ6N+/v+Y97733Hp577jls3boVDQ0N0nG96p9dunRRPBcDap07d9Y9XlZWpjjes2dPhScZAPTu3RuA23etXbt2mnPu2LEDgDuI5Yvy8nK0aNHC5+t67NmzRwoCyunXr5/0+oABA6Tjer8PPbKysgAAlZWVARczSElJQZs2bRTHWrRoofn9/e9//8Pjjz+OdevWoa6uTjqu/p0C2r7y9Z167xV/l2VlZcjKysKOHTsgCAJ69eql2/7ExEQfPxkhhBBC4g0G0QghhBBiSnbt2iUFoTZu3Kh5/cMPP8TVV1+Nc889F/fccw/atm0Lh8OBWbNm4a+//tK83+Fw6J7H13FBEMJovRtRZfbMM89gyJAhuu/JyMgI+zz+CNQEv2/fvgDcv++xY8cG9Blfvz85S5cuxdlnn41x48bh1VdfRfv27ZGYmIh33nkHc+bMCfg79frE33tdLhdsNhu+++473fdG4/dPCCGEEHPAIBohhBBCTIfL5cLVV1+NrKws3HHHHZg5cyb+9re/4fzzz5fe8/nnn6N79+748ssvFWqmGTNmGNKmnTt3QhAExbm2b98OwF29Uw8xJTErKwsTJkyIWFu6du2Kbdu2aY5v3bpVej0UJk+ejFmzZuHDDz8MOIgWCF988QVSUlKwcOFCJCcnS8ffeeediJ3DFz169IAgCOjWrZukHCSEEEII0YOeaIQQQggxHc8//zyWLVuG119/HY899hjGjBmDm266CcXFxdJ7RFWRXJ20YsUKLF++3JA2HTx4UFH5sqKiAu+//z6GDBmim8oJAMOGDUOPHj3w7LPPoqqqSvP64cOHQ2rLGWecgZUrVyp+1urqarz++uvIy8vTTX0NhNGjR+P000/Hm2++ia+//lrzen19vW7lUn84HA7YbDY4nU7pWH5+vu45Is35558Ph8OBRx55RKNkEwRBt+InIYQQQuITKtEIIYQQ0qz47rvvJMWUnDFjxqB79+7YsmULHnroIVx99dWYPHkyAODdd9/FkCFDcPPNN+PTTz8FAJx11ln48ss
2024-05-08 08:26:31 +02:00
"text/plain": [
"<Figure size 1500x400 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-05-15 20:20:01 +02:00
"wfdb.plot_items(data['SB'][24].p_signal[:,0],title=\"Example for Channel 1\",figsize=(15,4))"
2024-05-07 20:16:12 +02:00
]
2024-05-01 12:53:33 +02:00
}
],
"metadata": {
2024-05-07 20:16:12 +02:00
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
2024-05-01 12:53:33 +02:00
"language_info": {
2024-05-07 20:16:12 +02:00
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2024-05-12 13:31:54 +02:00
"version": "3.10.4"
2024-05-01 12:53:33 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}