Georg Willer
commited on
Commit
·
708c7e0
1
Parent(s):
75eac09
Remove unused code
Browse files- 01_Model_Deployment_Research.ipynb +199 -99
- src/ecg_2_hrv_pipeline.py +1 -12
- usage_instructions.ipynb +298 -10
01_Model_Deployment_Research.ipynb
CHANGED
@@ -714,7 +714,7 @@
|
|
714 |
},
|
715 |
{
|
716 |
"cell_type": "code",
|
717 |
-
"execution_count":
|
718 |
"metadata": {},
|
719 |
"outputs": [],
|
720 |
"source": [
|
@@ -726,7 +726,7 @@
|
|
726 |
},
|
727 |
{
|
728 |
"cell_type": "code",
|
729 |
-
"execution_count":
|
730 |
"metadata": {},
|
731 |
"outputs": [],
|
732 |
"source": [
|
@@ -735,7 +735,7 @@
|
|
735 |
},
|
736 |
{
|
737 |
"cell_type": "code",
|
738 |
-
"execution_count":
|
739 |
"metadata": {},
|
740 |
"outputs": [
|
741 |
{
|
@@ -1090,7 +1090,7 @@
|
|
1090 |
},
|
1091 |
{
|
1092 |
"cell_type": "code",
|
1093 |
-
"execution_count":
|
1094 |
"metadata": {},
|
1095 |
"outputs": [],
|
1096 |
"source": [
|
@@ -1104,7 +1104,7 @@
|
|
1104 |
},
|
1105 |
{
|
1106 |
"cell_type": "code",
|
1107 |
-
"execution_count":
|
1108 |
"metadata": {},
|
1109 |
"outputs": [],
|
1110 |
"source": [
|
@@ -1113,7 +1113,7 @@
|
|
1113 |
},
|
1114 |
{
|
1115 |
"cell_type": "code",
|
1116 |
-
"execution_count":
|
1117 |
"metadata": {},
|
1118 |
"outputs": [
|
1119 |
{
|
@@ -1128,6 +1128,13 @@
|
|
1128 |
"pipe = pipeline(\"rpeaks-feature-extraction\", model = \"willergeorg/hubii-dummy\", trust_remote_code=True)"
|
1129 |
]
|
1130 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1131 |
{
|
1132 |
"cell_type": "code",
|
1133 |
"execution_count": null,
|
@@ -1288,56 +1295,34 @@
|
|
1288 |
"output_type": "stream",
|
1289 |
"text": [
|
1290 |
"Collecting ipywidgets\n",
|
1291 |
-
"
|
1292 |
-
"Requirement already satisfied: comm>=0.1.3 in c:\\users\\
|
1293 |
-
"Requirement already satisfied: ipython>=6.1.0 in c:\\users\\
|
1294 |
-
"Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\
|
1295 |
"Collecting widgetsnbextension~=4.0.12 (from ipywidgets)\n",
|
1296 |
-
"
|
1297 |
"Collecting jupyterlab-widgets~=3.0.12 (from ipywidgets)\n",
|
1298 |
-
"
|
1299 |
-
"Requirement already satisfied: colorama in c:\\users\\
|
1300 |
-
"Requirement already satisfied: decorator in c:\\users\\
|
1301 |
-
"Requirement already satisfied:
|
1302 |
-
"Requirement already satisfied:
|
1303 |
-
"Requirement already satisfied:
|
1304 |
-
"Requirement already satisfied:
|
1305 |
-
"Requirement already satisfied:
|
1306 |
-
"Requirement already satisfied:
|
1307 |
-
"Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\
|
1308 |
-
"Requirement already satisfied: wcwidth in c:\\users\\
|
1309 |
-
"Requirement already satisfied: executing>=1.2.0 in c:\\users\\
|
1310 |
-
"Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\
|
1311 |
-
"Requirement already satisfied: pure-eval in c:\\users\\
|
1312 |
-
"
|
1313 |
-
"
|
1314 |
-
"
|
1315 |
-
" -------- ------------------------------ 30.7/139.8 kB 660.6 kB/s eta 0:00:01\n",
|
1316 |
-
" -------------------------------------- - 133.1/139.8 kB 1.6 MB/s eta 0:00:01\n",
|
1317 |
-
" ---------------------------------------- 139.8/139.8 kB 1.4 MB/s eta 0:00:00\n",
|
1318 |
-
"Downloading jupyterlab_widgets-3.0.13-py3-none-any.whl (214 kB)\n",
|
1319 |
-
" ---------------------------------------- 0.0/214.4 kB ? eta -:--:--\n",
|
1320 |
-
" --------------------------------------- 214.4/214.4 kB 13.6 MB/s eta 0:00:00\n",
|
1321 |
-
"Downloading widgetsnbextension-4.0.13-py3-none-any.whl (2.3 MB)\n",
|
1322 |
-
" ---------------------------------------- 0.0/2.3 MB ? eta -:--:--\n",
|
1323 |
-
" ---------- ----------------------------- 0.6/2.3 MB 12.9 MB/s eta 0:00:01\n",
|
1324 |
-
" ------------------------ --------------- 1.4/2.3 MB 14.8 MB/s eta 0:00:01\n",
|
1325 |
-
" ---------------------------------- ----- 2.0/2.3 MB 14.3 MB/s eta 0:00:01\n",
|
1326 |
-
" --------------------------------------- 2.3/2.3 MB 12.4 MB/s eta 0:00:01\n",
|
1327 |
-
" ---------------------------------------- 2.3/2.3 MB 12.4 MB/s eta 0:00:00\n",
|
1328 |
"Installing collected packages: widgetsnbextension, jupyterlab-widgets, ipywidgets\n",
|
1329 |
"Successfully installed ipywidgets-8.1.5 jupyterlab-widgets-3.0.13 widgetsnbextension-4.0.13\n",
|
1330 |
"Note: you may need to restart the kernel to use updated packages.\n"
|
1331 |
]
|
1332 |
-
},
|
1333 |
-
{
|
1334 |
-
"name": "stderr",
|
1335 |
-
"output_type": "stream",
|
1336 |
-
"text": [
|
1337 |
-
"\n",
|
1338 |
-
"[notice] A new release of pip is available: 24.0 -> 25.0.1\n",
|
1339 |
-
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
|
1340 |
-
]
|
1341 |
}
|
1342 |
],
|
1343 |
"source": [
|
@@ -1352,7 +1337,7 @@
|
|
1352 |
{
|
1353 |
"data": {
|
1354 |
"application/vnd.jupyter.widget-view+json": {
|
1355 |
-
"model_id": "
|
1356 |
"version_major": 2,
|
1357 |
"version_minor": 0
|
1358 |
},
|
@@ -1364,25 +1349,37 @@
|
|
1364 |
"output_type": "display_data"
|
1365 |
},
|
1366 |
{
|
1367 |
-
"
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
"
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
"
|
|
|
|
|
1385 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1386 |
}
|
1387 |
],
|
1388 |
"source": [
|
@@ -11910,52 +11907,155 @@
|
|
11910 |
},
|
11911 |
{
|
11912 |
"cell_type": "code",
|
11913 |
-
"execution_count":
|
11914 |
"metadata": {},
|
11915 |
"outputs": [
|
11916 |
{
|
11917 |
-
"
|
11918 |
-
"
|
11919 |
-
"
|
11920 |
-
|
11921 |
-
"\
|
11922 |
-
"\u001b[31mNameError\u001b[39m Traceback (most recent call last)",
|
11923 |
-
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m file_path = \u001b[33m\"\u001b[39m\u001b[33m./Data/hr_rr_Elias-Rec_1703_162053.csv\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m result = \u001b[43mpipe\u001b[49m(inputs=file_path, windowing_method=\u001b[33m\"\u001b[39m\u001b[33mrolling\u001b[39m\u001b[33m\"\u001b[39m, window_size=\u001b[33m\"\u001b[39m\u001b[33m60s\u001b[39m\u001b[33m\"\u001b[39m, frequency=\u001b[32m10\u001b[39m)\n\u001b[32m 3\u001b[39m result.head()\n",
|
11924 |
-
"\u001b[31mNameError\u001b[39m: name 'pipe' is not defined"
|
11925 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11926 |
}
|
11927 |
],
|
11928 |
"source": [
|
11929 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
11930 |
-
"result = pipe(inputs=file_path, windowing_method=\"
|
11931 |
"result.head()"
|
11932 |
]
|
11933 |
},
|
11934 |
{
|
11935 |
"cell_type": "code",
|
11936 |
-
"execution_count":
|
11937 |
"metadata": {},
|
11938 |
"outputs": [
|
11939 |
{
|
11940 |
-
"
|
11941 |
-
|
11942 |
-
|
11943 |
-
|
11944 |
-
|
11945 |
-
|
11946 |
-
"
|
11947 |
-
|
11948 |
-
|
11949 |
-
|
11950 |
-
|
11951 |
-
|
11952 |
-
|
11953 |
-
|
11954 |
-
|
11955 |
-
|
11956 |
-
|
11957 |
-
"
|
|
|
|
|
11958 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11959 |
}
|
11960 |
],
|
11961 |
"source": [
|
@@ -12101,7 +12201,7 @@
|
|
12101 |
"name": "python",
|
12102 |
"nbconvert_exporter": "python",
|
12103 |
"pygments_lexer": "ipython3",
|
12104 |
-
"version": "3.
|
12105 |
}
|
12106 |
},
|
12107 |
"nbformat": 4,
|
|
|
714 |
},
|
715 |
{
|
716 |
"cell_type": "code",
|
717 |
+
"execution_count": 1,
|
718 |
"metadata": {},
|
719 |
"outputs": [],
|
720 |
"source": [
|
|
|
726 |
},
|
727 |
{
|
728 |
"cell_type": "code",
|
729 |
+
"execution_count": 2,
|
730 |
"metadata": {},
|
731 |
"outputs": [],
|
732 |
"source": [
|
|
|
735 |
},
|
736 |
{
|
737 |
"cell_type": "code",
|
738 |
+
"execution_count": 3,
|
739 |
"metadata": {},
|
740 |
"outputs": [
|
741 |
{
|
|
|
1090 |
},
|
1091 |
{
|
1092 |
"cell_type": "code",
|
1093 |
+
"execution_count": 4,
|
1094 |
"metadata": {},
|
1095 |
"outputs": [],
|
1096 |
"source": [
|
|
|
1104 |
},
|
1105 |
{
|
1106 |
"cell_type": "code",
|
1107 |
+
"execution_count": 5,
|
1108 |
"metadata": {},
|
1109 |
"outputs": [],
|
1110 |
"source": [
|
|
|
1113 |
},
|
1114 |
{
|
1115 |
"cell_type": "code",
|
1116 |
+
"execution_count": 6,
|
1117 |
"metadata": {},
|
1118 |
"outputs": [
|
1119 |
{
|
|
|
1128 |
"pipe = pipeline(\"rpeaks-feature-extraction\", model = \"willergeorg/hubii-dummy\", trust_remote_code=True)"
|
1129 |
]
|
1130 |
},
|
1131 |
+
{
|
1132 |
+
"cell_type": "code",
|
1133 |
+
"execution_count": null,
|
1134 |
+
"metadata": {},
|
1135 |
+
"outputs": [],
|
1136 |
+
"source": []
|
1137 |
+
},
|
1138 |
{
|
1139 |
"cell_type": "code",
|
1140 |
"execution_count": null,
|
|
|
1295 |
"output_type": "stream",
|
1296 |
"text": [
|
1297 |
"Collecting ipywidgets\n",
|
1298 |
+
" Using cached ipywidgets-8.1.5-py3-none-any.whl.metadata (2.3 kB)\n",
|
1299 |
+
"Requirement already satisfied: comm>=0.1.3 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipywidgets) (0.2.2)\n",
|
1300 |
+
"Requirement already satisfied: ipython>=6.1.0 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipywidgets) (8.32.0)\n",
|
1301 |
+
"Requirement already satisfied: traitlets>=4.3.1 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipywidgets) (5.14.3)\n",
|
1302 |
"Collecting widgetsnbextension~=4.0.12 (from ipywidgets)\n",
|
1303 |
+
" Using cached widgetsnbextension-4.0.13-py3-none-any.whl.metadata (1.6 kB)\n",
|
1304 |
"Collecting jupyterlab-widgets~=3.0.12 (from ipywidgets)\n",
|
1305 |
+
" Using cached jupyterlab_widgets-3.0.13-py3-none-any.whl.metadata (4.1 kB)\n",
|
1306 |
+
"Requirement already satisfied: colorama in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (0.4.6)\n",
|
1307 |
+
"Requirement already satisfied: decorator in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (5.1.1)\n",
|
1308 |
+
"Requirement already satisfied: jedi>=0.16 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (0.19.2)\n",
|
1309 |
+
"Requirement already satisfied: matplotlib-inline in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (0.1.7)\n",
|
1310 |
+
"Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (3.0.50)\n",
|
1311 |
+
"Requirement already satisfied: pygments>=2.4.0 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (2.19.1)\n",
|
1312 |
+
"Requirement already satisfied: stack_data in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (0.6.3)\n",
|
1313 |
+
"Requirement already satisfied: typing_extensions>=4.6 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from ipython>=6.1.0->ipywidgets) (4.12.2)\n",
|
1314 |
+
"Requirement already satisfied: parso<0.9.0,>=0.8.4 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets) (0.8.4)\n",
|
1315 |
+
"Requirement already satisfied: wcwidth in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets) (0.2.13)\n",
|
1316 |
+
"Requirement already satisfied: executing>=1.2.0 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (2.2.0)\n",
|
1317 |
+
"Requirement already satisfied: asttokens>=2.1.0 in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (3.0.0)\n",
|
1318 |
+
"Requirement already satisfied: pure-eval in c:\\users\\georg\\desktop\\hiwi\\ecg2hrv\\.venv\\lib\\site-packages (from stack_data->ipython>=6.1.0->ipywidgets) (0.2.3)\n",
|
1319 |
+
"Using cached ipywidgets-8.1.5-py3-none-any.whl (139 kB)\n",
|
1320 |
+
"Using cached jupyterlab_widgets-3.0.13-py3-none-any.whl (214 kB)\n",
|
1321 |
+
"Using cached widgetsnbextension-4.0.13-py3-none-any.whl (2.3 MB)\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1322 |
"Installing collected packages: widgetsnbextension, jupyterlab-widgets, ipywidgets\n",
|
1323 |
"Successfully installed ipywidgets-8.1.5 jupyterlab-widgets-3.0.13 widgetsnbextension-4.0.13\n",
|
1324 |
"Note: you may need to restart the kernel to use updated packages.\n"
|
1325 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1326 |
}
|
1327 |
],
|
1328 |
"source": [
|
|
|
1337 |
{
|
1338 |
"data": {
|
1339 |
"application/vnd.jupyter.widget-view+json": {
|
1340 |
+
"model_id": "c0c5fb8785a04ff3afefc29701dd3559",
|
1341 |
"version_major": 2,
|
1342 |
"version_minor": 0
|
1343 |
},
|
|
|
1349 |
"output_type": "display_data"
|
1350 |
},
|
1351 |
{
|
1352 |
+
"data": {
|
1353 |
+
"application/vnd.jupyter.widget-view+json": {
|
1354 |
+
"model_id": "4e2be98a1c1c470bb14b8e4138c2b4c2",
|
1355 |
+
"version_major": 2,
|
1356 |
+
"version_minor": 0
|
1357 |
+
},
|
1358 |
+
"text/plain": [
|
1359 |
+
"README.md: 0%| | 0.00/5.17k [00:00<?, ?B/s]"
|
1360 |
+
]
|
1361 |
+
},
|
1362 |
+
"metadata": {},
|
1363 |
+
"output_type": "display_data"
|
1364 |
+
},
|
1365 |
+
{
|
1366 |
+
"name": "stderr",
|
1367 |
+
"output_type": "stream",
|
1368 |
+
"text": [
|
1369 |
+
"c:\\Users\\georg\\Desktop\\HIWI\\ECG2HRV\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:140: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\georg\\.cache\\huggingface\\hub\\models--willergeorg--rpeaks-to-hrv-pipeline. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
|
1370 |
+
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
1371 |
+
" warnings.warn(message)\n"
|
1372 |
]
|
1373 |
+
},
|
1374 |
+
{
|
1375 |
+
"data": {
|
1376 |
+
"text/plain": [
|
1377 |
+
"CommitInfo(commit_url='https://huggingface.co/willergeorg/rpeaks-to-hrv-pipeline/commit/486f1649a11e62de886ffc1497d2bdf202dec8bb', commit_message='Upload RPeak2HRVPipeline', commit_description='', oid='486f1649a11e62de886ffc1497d2bdf202dec8bb', pr_url=None, repo_url=RepoUrl('https://huggingface.co/willergeorg/rpeaks-to-hrv-pipeline', endpoint='https://huggingface.co', repo_type='model', repo_id='willergeorg/rpeaks-to-hrv-pipeline'), pr_revision=None, pr_num=None)"
|
1378 |
+
]
|
1379 |
+
},
|
1380 |
+
"execution_count": 7,
|
1381 |
+
"metadata": {},
|
1382 |
+
"output_type": "execute_result"
|
1383 |
}
|
1384 |
],
|
1385 |
"source": [
|
|
|
11907 |
},
|
11908 |
{
|
11909 |
"cell_type": "code",
|
11910 |
+
"execution_count": 4,
|
11911 |
"metadata": {},
|
11912 |
"outputs": [
|
11913 |
{
|
11914 |
+
"name": "stderr",
|
11915 |
+
"output_type": "stream",
|
11916 |
+
"text": [
|
11917 |
+
"c:\\Users\\georg\\Desktop\\HIWI\\ECG2HRV\\src\\rpeaks2hrv.py:24: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
|
11918 |
+
" hrv_values = pd.concat([hrv_values, hrv_time], ignore_index=True)\n"
|
|
|
|
|
|
|
11919 |
]
|
11920 |
+
},
|
11921 |
+
{
|
11922 |
+
"data": {
|
11923 |
+
"text/html": [
|
11924 |
+
"<div>\n",
|
11925 |
+
"<style scoped>\n",
|
11926 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
11927 |
+
" vertical-align: middle;\n",
|
11928 |
+
" }\n",
|
11929 |
+
"\n",
|
11930 |
+
" .dataframe tbody tr th {\n",
|
11931 |
+
" vertical-align: top;\n",
|
11932 |
+
" }\n",
|
11933 |
+
"\n",
|
11934 |
+
" .dataframe thead th {\n",
|
11935 |
+
" text-align: right;\n",
|
11936 |
+
" }\n",
|
11937 |
+
"</style>\n",
|
11938 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
11939 |
+
" <thead>\n",
|
11940 |
+
" <tr style=\"text-align: right;\">\n",
|
11941 |
+
" <th></th>\n",
|
11942 |
+
" <th>window_start</th>\n",
|
11943 |
+
" <th>window_end</th>\n",
|
11944 |
+
" <th>HRV_MeanNN</th>\n",
|
11945 |
+
" <th>HRV_SDNN</th>\n",
|
11946 |
+
" <th>HRV_SDANN1</th>\n",
|
11947 |
+
" <th>HRV_SDNNI1</th>\n",
|
11948 |
+
" <th>HRV_SDANN2</th>\n",
|
11949 |
+
" <th>HRV_SDNNI2</th>\n",
|
11950 |
+
" <th>HRV_SDANN5</th>\n",
|
11951 |
+
" <th>HRV_SDNNI5</th>\n",
|
11952 |
+
" <th>...</th>\n",
|
11953 |
+
" <th>HRV_IQRNN</th>\n",
|
11954 |
+
" <th>HRV_SDRMSSD</th>\n",
|
11955 |
+
" <th>HRV_Prc20NN</th>\n",
|
11956 |
+
" <th>HRV_Prc80NN</th>\n",
|
11957 |
+
" <th>HRV_pNN50</th>\n",
|
11958 |
+
" <th>HRV_pNN20</th>\n",
|
11959 |
+
" <th>HRV_MinNN</th>\n",
|
11960 |
+
" <th>HRV_MaxNN</th>\n",
|
11961 |
+
" <th>HRV_HTI</th>\n",
|
11962 |
+
" <th>HRV_TINN</th>\n",
|
11963 |
+
" </tr>\n",
|
11964 |
+
" </thead>\n",
|
11965 |
+
" <tbody>\n",
|
11966 |
+
" <tr>\n",
|
11967 |
+
" <th>0</th>\n",
|
11968 |
+
" <td>2025-03-17 17:32:40.430678701</td>\n",
|
11969 |
+
" <td>2025-03-17 17:33:39.436569259</td>\n",
|
11970 |
+
" <td>826.449008</td>\n",
|
11971 |
+
" <td>199.477249</td>\n",
|
11972 |
+
" <td>NaN</td>\n",
|
11973 |
+
" <td>NaN</td>\n",
|
11974 |
+
" <td>NaN</td>\n",
|
11975 |
+
" <td>NaN</td>\n",
|
11976 |
+
" <td>NaN</td>\n",
|
11977 |
+
" <td>NaN</td>\n",
|
11978 |
+
" <td>...</td>\n",
|
11979 |
+
" <td>156.738281</td>\n",
|
11980 |
+
" <td>7.174916</td>\n",
|
11981 |
+
" <td>693.945312</td>\n",
|
11982 |
+
" <td>927.929688</td>\n",
|
11983 |
+
" <td>0.0</td>\n",
|
11984 |
+
" <td>33.333333</td>\n",
|
11985 |
+
" <td>273.4375</td>\n",
|
11986 |
+
" <td>1605.46875</td>\n",
|
11987 |
+
" <td>14.8</td>\n",
|
11988 |
+
" <td>554.6875</td>\n",
|
11989 |
+
" </tr>\n",
|
11990 |
+
" </tbody>\n",
|
11991 |
+
"</table>\n",
|
11992 |
+
"<p>1 rows × 27 columns</p>\n",
|
11993 |
+
"</div>"
|
11994 |
+
],
|
11995 |
+
"text/plain": [
|
11996 |
+
" window_start window_end HRV_MeanNN \\\n",
|
11997 |
+
"0 2025-03-17 17:32:40.430678701 2025-03-17 17:33:39.436569259 826.449008 \n",
|
11998 |
+
"\n",
|
11999 |
+
" HRV_SDNN HRV_SDANN1 HRV_SDNNI1 HRV_SDANN2 HRV_SDNNI2 HRV_SDANN5 \\\n",
|
12000 |
+
"0 199.477249 NaN NaN NaN NaN NaN \n",
|
12001 |
+
"\n",
|
12002 |
+
" HRV_SDNNI5 ... HRV_IQRNN HRV_SDRMSSD HRV_Prc20NN HRV_Prc80NN \\\n",
|
12003 |
+
"0 NaN ... 156.738281 7.174916 693.945312 927.929688 \n",
|
12004 |
+
"\n",
|
12005 |
+
" HRV_pNN50 HRV_pNN20 HRV_MinNN HRV_MaxNN HRV_HTI HRV_TINN \n",
|
12006 |
+
"0 0.0 33.333333 273.4375 1605.46875 14.8 554.6875 \n",
|
12007 |
+
"\n",
|
12008 |
+
"[1 rows x 27 columns]"
|
12009 |
+
]
|
12010 |
+
},
|
12011 |
+
"execution_count": 4,
|
12012 |
+
"metadata": {},
|
12013 |
+
"output_type": "execute_result"
|
12014 |
}
|
12015 |
],
|
12016 |
"source": [
|
12017 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
12018 |
+
"result = pipe(inputs=file_path, windowing_method=\"last_interval\", window_size=\"60s\", frequency=10)\n",
|
12019 |
"result.head()"
|
12020 |
]
|
12021 |
},
|
12022 |
{
|
12023 |
"cell_type": "code",
|
12024 |
+
"execution_count": 5,
|
12025 |
"metadata": {},
|
12026 |
"outputs": [
|
12027 |
{
|
12028 |
+
"data": {
|
12029 |
+
"application/vnd.jupyter.widget-view+json": {
|
12030 |
+
"model_id": "c59747b5e8ae4754b558c555efdd8820",
|
12031 |
+
"version_major": 2,
|
12032 |
+
"version_minor": 0
|
12033 |
+
},
|
12034 |
+
"text/plain": [
|
12035 |
+
"README.md: 0%| | 0.00/5.17k [00:00<?, ?B/s]"
|
12036 |
+
]
|
12037 |
+
},
|
12038 |
+
"metadata": {},
|
12039 |
+
"output_type": "display_data"
|
12040 |
+
},
|
12041 |
+
{
|
12042 |
+
"name": "stderr",
|
12043 |
+
"output_type": "stream",
|
12044 |
+
"text": [
|
12045 |
+
"c:\\Users\\georg\\Desktop\\HIWI\\ECG2HRV\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:140: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\georg\\.cache\\huggingface\\hub\\models--willergeorg--rpeaks-to-hrv-pipeline. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
|
12046 |
+
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
12047 |
+
" warnings.warn(message)\n"
|
12048 |
]
|
12049 |
+
},
|
12050 |
+
{
|
12051 |
+
"data": {
|
12052 |
+
"text/plain": [
|
12053 |
+
"CommitInfo(commit_url='https://huggingface.co/willergeorg/rpeaks-to-hrv-pipeline/commit/70436e8045dae6e105e52f1cdb6a7bfece698a6d', commit_message='Upload RPeak2HRVPipeline', commit_description='', oid='70436e8045dae6e105e52f1cdb6a7bfece698a6d', pr_url=None, repo_url=RepoUrl('https://huggingface.co/willergeorg/rpeaks-to-hrv-pipeline', endpoint='https://huggingface.co', repo_type='model', repo_id='willergeorg/rpeaks-to-hrv-pipeline'), pr_revision=None, pr_num=None)"
|
12054 |
+
]
|
12055 |
+
},
|
12056 |
+
"execution_count": 5,
|
12057 |
+
"metadata": {},
|
12058 |
+
"output_type": "execute_result"
|
12059 |
}
|
12060 |
],
|
12061 |
"source": [
|
|
|
12201 |
"name": "python",
|
12202 |
"nbconvert_exporter": "python",
|
12203 |
"pygments_lexer": "ipython3",
|
12204 |
+
"version": "3.11.6"
|
12205 |
}
|
12206 |
},
|
12207 |
"nbformat": 4,
|
src/ecg_2_hrv_pipeline.py
CHANGED
@@ -23,15 +23,4 @@ class Ecg2HrvPipeline(Pipeline):
|
|
23 |
return model_inputs
|
24 |
|
25 |
def postprocess(self, model_outputs):
|
26 |
-
return model_outputs
|
27 |
-
|
28 |
-
|
29 |
-
""" def __init__(self, model):
|
30 |
-
super.__init__(model)
|
31 |
-
|
32 |
-
def __init__(self, frequency = 100, baseline = None, normalization_method = None, **):
|
33 |
-
self.ecg2HrvExtractor = ECG2HRV()
|
34 |
-
self.frequency = 100
|
35 |
-
self.baseline = baseline
|
36 |
-
self.normalization_method = normalization_method
|
37 |
-
super.__init__(model) """
|
|
|
23 |
return model_inputs
|
24 |
|
25 |
def postprocess(self, model_outputs):
|
26 |
+
return model_outputs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usage_instructions.ipynb
CHANGED
@@ -35,13 +35,90 @@
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
-
"execution_count":
|
39 |
"metadata": {},
|
40 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
"source": [
|
42 |
"from transformers import pipeline\n",
|
43 |
"\n",
|
44 |
-
"rpeak2hrv_pipeline = pipeline(model = \"
|
45 |
]
|
46 |
},
|
47 |
{
|
@@ -81,12 +158,108 @@
|
|
81 |
},
|
82 |
{
|
83 |
"cell_type": "code",
|
84 |
-
"execution_count":
|
85 |
"metadata": {},
|
86 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
"source": [
|
88 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
89 |
-
"result = rpeak2hrv_pipeline(inputs=file_path, sampling_rate=
|
|
|
90 |
]
|
91 |
},
|
92 |
{
|
@@ -144,12 +317,119 @@
|
|
144 |
},
|
145 |
{
|
146 |
"cell_type": "code",
|
147 |
-
"execution_count":
|
148 |
"metadata": {},
|
149 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
"source": [
|
151 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
152 |
-
"result = rpeak2hrv_pipeline(
|
153 |
"result.head()"
|
154 |
]
|
155 |
},
|
@@ -198,8 +478,16 @@
|
|
198 |
"name": "python3"
|
199 |
},
|
200 |
"language_info": {
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
"name": "python",
|
202 |
-
"
|
|
|
|
|
203 |
}
|
204 |
},
|
205 |
"nbformat": 4,
|
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
+
"execution_count": 6,
|
39 |
"metadata": {},
|
40 |
+
"outputs": [
|
41 |
+
{
|
42 |
+
"data": {
|
43 |
+
"application/vnd.jupyter.widget-view+json": {
|
44 |
+
"model_id": "5e6901339e274840a9447cffdba845e6",
|
45 |
+
"version_major": 2,
|
46 |
+
"version_minor": 0
|
47 |
+
},
|
48 |
+
"text/plain": [
|
49 |
+
"config.json: 0%| | 0.00/829 [00:00<?, ?B/s]"
|
50 |
+
]
|
51 |
+
},
|
52 |
+
"metadata": {},
|
53 |
+
"output_type": "display_data"
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"data": {
|
57 |
+
"application/vnd.jupyter.widget-view+json": {
|
58 |
+
"model_id": "b42b83a842aa4d338df4f42c4571080b",
|
59 |
+
"version_major": 2,
|
60 |
+
"version_minor": 0
|
61 |
+
},
|
62 |
+
"text/plain": [
|
63 |
+
"rpeaks_2_hrv_pipeline.py: 0%| | 0.00/1.76k [00:00<?, ?B/s]"
|
64 |
+
]
|
65 |
+
},
|
66 |
+
"metadata": {},
|
67 |
+
"output_type": "display_data"
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"data": {
|
71 |
+
"application/vnd.jupyter.widget-view+json": {
|
72 |
+
"model_id": "ccc1bab946ad45ee9bb7473e0ecac1e7",
|
73 |
+
"version_major": 2,
|
74 |
+
"version_minor": 0
|
75 |
+
},
|
76 |
+
"text/plain": [
|
77 |
+
"rpeaks2hrv.py: 0%| | 0.00/7.54k [00:00<?, ?B/s]"
|
78 |
+
]
|
79 |
+
},
|
80 |
+
"metadata": {},
|
81 |
+
"output_type": "display_data"
|
82 |
+
},
|
83 |
+
{
|
84 |
+
"name": "stderr",
|
85 |
+
"output_type": "stream",
|
86 |
+
"text": [
|
87 |
+
"A new version of the following files was downloaded from https://huggingface.co/hubii-world/rpeaks-to-hrv-pipeline:\n",
|
88 |
+
"- rpeaks2hrv.py\n",
|
89 |
+
". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n",
|
90 |
+
"A new version of the following files was downloaded from https://huggingface.co/hubii-world/rpeaks-to-hrv-pipeline:\n",
|
91 |
+
"- rpeaks_2_hrv_pipeline.py\n",
|
92 |
+
"- rpeaks2hrv.py\n",
|
93 |
+
". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n"
|
94 |
+
]
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"data": {
|
98 |
+
"application/vnd.jupyter.widget-view+json": {
|
99 |
+
"model_id": "c572acc1c2654d9599b1545b1810ff5b",
|
100 |
+
"version_major": 2,
|
101 |
+
"version_minor": 0
|
102 |
+
},
|
103 |
+
"text/plain": [
|
104 |
+
"model.safetensors: 0%| | 0.00/649k [00:00<?, ?B/s]"
|
105 |
+
]
|
106 |
+
},
|
107 |
+
"metadata": {},
|
108 |
+
"output_type": "display_data"
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"name": "stderr",
|
112 |
+
"output_type": "stream",
|
113 |
+
"text": [
|
114 |
+
"Device set to use cpu\n"
|
115 |
+
]
|
116 |
+
}
|
117 |
+
],
|
118 |
"source": [
|
119 |
"from transformers import pipeline\n",
|
120 |
"\n",
|
121 |
+
"rpeak2hrv_pipeline = pipeline(model = \"hubii-world/rpeaks-to-hrv-pipeline\", trust_remote_code=True)"
|
122 |
]
|
123 |
},
|
124 |
{
|
|
|
158 |
},
|
159 |
{
|
160 |
"cell_type": "code",
|
161 |
+
"execution_count": 9,
|
162 |
"metadata": {},
|
163 |
+
"outputs": [
|
164 |
+
{
|
165 |
+
"data": {
|
166 |
+
"text/html": [
|
167 |
+
"<div>\n",
|
168 |
+
"<style scoped>\n",
|
169 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
170 |
+
" vertical-align: middle;\n",
|
171 |
+
" }\n",
|
172 |
+
"\n",
|
173 |
+
" .dataframe tbody tr th {\n",
|
174 |
+
" vertical-align: top;\n",
|
175 |
+
" }\n",
|
176 |
+
"\n",
|
177 |
+
" .dataframe thead th {\n",
|
178 |
+
" text-align: right;\n",
|
179 |
+
" }\n",
|
180 |
+
"</style>\n",
|
181 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
182 |
+
" <thead>\n",
|
183 |
+
" <tr style=\"text-align: right;\">\n",
|
184 |
+
" <th></th>\n",
|
185 |
+
" <th>HRV_MeanNN</th>\n",
|
186 |
+
" <th>HRV_SDNN</th>\n",
|
187 |
+
" <th>HRV_SDANN1</th>\n",
|
188 |
+
" <th>HRV_SDNNI1</th>\n",
|
189 |
+
" <th>HRV_SDANN2</th>\n",
|
190 |
+
" <th>HRV_SDNNI2</th>\n",
|
191 |
+
" <th>HRV_SDANN5</th>\n",
|
192 |
+
" <th>HRV_SDNNI5</th>\n",
|
193 |
+
" <th>HRV_RMSSD</th>\n",
|
194 |
+
" <th>HRV_SDSD</th>\n",
|
195 |
+
" <th>...</th>\n",
|
196 |
+
" <th>HRV_ULF</th>\n",
|
197 |
+
" <th>HRV_VLF</th>\n",
|
198 |
+
" <th>HRV_LF</th>\n",
|
199 |
+
" <th>HRV_HF</th>\n",
|
200 |
+
" <th>HRV_VHF</th>\n",
|
201 |
+
" <th>HRV_TP</th>\n",
|
202 |
+
" <th>HRV_LFHF</th>\n",
|
203 |
+
" <th>HRV_LFn</th>\n",
|
204 |
+
" <th>HRV_HFn</th>\n",
|
205 |
+
" <th>HRV_LnHF</th>\n",
|
206 |
+
" </tr>\n",
|
207 |
+
" </thead>\n",
|
208 |
+
" <tbody>\n",
|
209 |
+
" <tr>\n",
|
210 |
+
" <th>0</th>\n",
|
211 |
+
" <td>1006.894005</td>\n",
|
212 |
+
" <td>159.530641</td>\n",
|
213 |
+
" <td>72.830794</td>\n",
|
214 |
+
" <td>137.277955</td>\n",
|
215 |
+
" <td>56.912177</td>\n",
|
216 |
+
" <td>143.4821</td>\n",
|
217 |
+
" <td>45.675812</td>\n",
|
218 |
+
" <td>152.633402</td>\n",
|
219 |
+
" <td>107.280546</td>\n",
|
220 |
+
" <td>102.397785</td>\n",
|
221 |
+
" <td>...</td>\n",
|
222 |
+
" <td>0.000497</td>\n",
|
223 |
+
" <td>0.010289</td>\n",
|
224 |
+
" <td>0.024415</td>\n",
|
225 |
+
" <td>0.070705</td>\n",
|
226 |
+
" <td>0.026376</td>\n",
|
227 |
+
" <td>0.132282</td>\n",
|
228 |
+
" <td>0.345306</td>\n",
|
229 |
+
" <td>0.184566</td>\n",
|
230 |
+
" <td>0.5345</td>\n",
|
231 |
+
" <td>-2.649243</td>\n",
|
232 |
+
" </tr>\n",
|
233 |
+
" </tbody>\n",
|
234 |
+
"</table>\n",
|
235 |
+
"<p>1 rows × 35 columns</p>\n",
|
236 |
+
"</div>"
|
237 |
+
],
|
238 |
+
"text/plain": [
|
239 |
+
" HRV_MeanNN HRV_SDNN HRV_SDANN1 HRV_SDNNI1 HRV_SDANN2 HRV_SDNNI2 \\\n",
|
240 |
+
"0 1006.894005 159.530641 72.830794 137.277955 56.912177 143.4821 \n",
|
241 |
+
"\n",
|
242 |
+
" HRV_SDANN5 HRV_SDNNI5 HRV_RMSSD HRV_SDSD ... HRV_ULF HRV_VLF \\\n",
|
243 |
+
"0 45.675812 152.633402 107.280546 102.397785 ... 0.000497 0.010289 \n",
|
244 |
+
"\n",
|
245 |
+
" HRV_LF HRV_HF HRV_VHF HRV_TP HRV_LFHF HRV_LFn HRV_HFn \\\n",
|
246 |
+
"0 0.024415 0.070705 0.026376 0.132282 0.345306 0.184566 0.5345 \n",
|
247 |
+
"\n",
|
248 |
+
" HRV_LnHF \n",
|
249 |
+
"0 -2.649243 \n",
|
250 |
+
"\n",
|
251 |
+
"[1 rows x 35 columns]"
|
252 |
+
]
|
253 |
+
},
|
254 |
+
"execution_count": 9,
|
255 |
+
"metadata": {},
|
256 |
+
"output_type": "execute_result"
|
257 |
+
}
|
258 |
+
],
|
259 |
"source": [
|
260 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
261 |
+
"result = rpeak2hrv_pipeline(inputs=file_path, feature_domains=['time', 'freq'], sampling_rate=1000)\n",
|
262 |
+
"result.head()"
|
263 |
]
|
264 |
},
|
265 |
{
|
|
|
317 |
},
|
318 |
{
|
319 |
"cell_type": "code",
|
320 |
+
"execution_count": 4,
|
321 |
"metadata": {},
|
322 |
+
"outputs": [
|
323 |
+
{
|
324 |
+
"name": "stderr",
|
325 |
+
"output_type": "stream",
|
326 |
+
"text": [
|
327 |
+
"c:\\Users\\georg\\Desktop\\HIWI\\ECG2HRV\\.venv\\Lib\\site-packages\\neurokit2\\hrv\\hrv_nonlinear.py:268: NeuroKitWarning: Missing interbeat intervals have been detected. Note that missing intervals can distort some HRV features, in particular nonlinear indices.\n",
|
328 |
+
" warn(\n",
|
329 |
+
"c:\\Users\\georg\\Desktop\\HIWI\\ECG2HRV\\.venv\\Lib\\site-packages\\neurokit2\\hrv\\hrv_nonlinear.py:529: NeuroKitWarning: DFA_alpha2 related indices will not be calculated. The maximum duration of the windows provided for the long-term correlation is smaller than the minimum duration of windows. Refer to the `scale` argument in `nk.fractal_dfa()` for more information.\n",
|
330 |
+
" warn(\n",
|
331 |
+
"C:\\Users\\georg\\.cache\\huggingface\\modules\\transformers_modules\\willergeorg\\rpeaks-to-hrv-pipeline\\354dfd60f24b9b5900052952ca632b87456e4701\\rpeaks2hrv.py:24: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
|
332 |
+
" hrv_values = pd.concat([hrv_values, hrv_time], ignore_index=True)\n"
|
333 |
+
]
|
334 |
+
},
|
335 |
+
{
|
336 |
+
"data": {
|
337 |
+
"text/html": [
|
338 |
+
"<div>\n",
|
339 |
+
"<style scoped>\n",
|
340 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
341 |
+
" vertical-align: middle;\n",
|
342 |
+
" }\n",
|
343 |
+
"\n",
|
344 |
+
" .dataframe tbody tr th {\n",
|
345 |
+
" vertical-align: top;\n",
|
346 |
+
" }\n",
|
347 |
+
"\n",
|
348 |
+
" .dataframe thead th {\n",
|
349 |
+
" text-align: right;\n",
|
350 |
+
" }\n",
|
351 |
+
"</style>\n",
|
352 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
353 |
+
" <thead>\n",
|
354 |
+
" <tr style=\"text-align: right;\">\n",
|
355 |
+
" <th></th>\n",
|
356 |
+
" <th>window_start</th>\n",
|
357 |
+
" <th>window_end</th>\n",
|
358 |
+
" <th>HRV_MeanNN</th>\n",
|
359 |
+
" <th>HRV_SDNN</th>\n",
|
360 |
+
" <th>HRV_SDANN1</th>\n",
|
361 |
+
" <th>HRV_SDNNI1</th>\n",
|
362 |
+
" <th>HRV_SDANN2</th>\n",
|
363 |
+
" <th>HRV_SDNNI2</th>\n",
|
364 |
+
" <th>HRV_SDANN5</th>\n",
|
365 |
+
" <th>HRV_SDNNI5</th>\n",
|
366 |
+
" <th>...</th>\n",
|
367 |
+
" <th>HRV_SampEn</th>\n",
|
368 |
+
" <th>HRV_ShanEn</th>\n",
|
369 |
+
" <th>HRV_FuzzyEn</th>\n",
|
370 |
+
" <th>HRV_MSEn</th>\n",
|
371 |
+
" <th>HRV_CMSEn</th>\n",
|
372 |
+
" <th>HRV_RCMSEn</th>\n",
|
373 |
+
" <th>HRV_CD</th>\n",
|
374 |
+
" <th>HRV_HFD</th>\n",
|
375 |
+
" <th>HRV_KFD</th>\n",
|
376 |
+
" <th>HRV_LZC</th>\n",
|
377 |
+
" </tr>\n",
|
378 |
+
" </thead>\n",
|
379 |
+
" <tbody>\n",
|
380 |
+
" <tr>\n",
|
381 |
+
" <th>0</th>\n",
|
382 |
+
" <td>2025-03-17 16:20:54.760848</td>\n",
|
383 |
+
" <td>2025-03-17 16:21:53.596623680</td>\n",
|
384 |
+
" <td>1060.358416</td>\n",
|
385 |
+
" <td>153.515505</td>\n",
|
386 |
+
" <td>NaN</td>\n",
|
387 |
+
" <td>NaN</td>\n",
|
388 |
+
" <td>NaN</td>\n",
|
389 |
+
" <td>NaN</td>\n",
|
390 |
+
" <td>NaN</td>\n",
|
391 |
+
" <td>NaN</td>\n",
|
392 |
+
" <td>...</td>\n",
|
393 |
+
" <td>1.265666</td>\n",
|
394 |
+
" <td>5.657451</td>\n",
|
395 |
+
" <td>1.330316</td>\n",
|
396 |
+
" <td>0.856145</td>\n",
|
397 |
+
" <td>0.9913</td>\n",
|
398 |
+
" <td>1.267671</td>\n",
|
399 |
+
" <td>1.82538</td>\n",
|
400 |
+
" <td>2.016523</td>\n",
|
401 |
+
" <td>2.937446</td>\n",
|
402 |
+
" <td>1.227977</td>\n",
|
403 |
+
" </tr>\n",
|
404 |
+
" </tbody>\n",
|
405 |
+
"</table>\n",
|
406 |
+
"<p>1 rows × 84 columns</p>\n",
|
407 |
+
"</div>"
|
408 |
+
],
|
409 |
+
"text/plain": [
|
410 |
+
" window_start window_end HRV_MeanNN \\\n",
|
411 |
+
"0 2025-03-17 16:20:54.760848 2025-03-17 16:21:53.596623680 1060.358416 \n",
|
412 |
+
"\n",
|
413 |
+
" HRV_SDNN HRV_SDANN1 HRV_SDNNI1 HRV_SDANN2 HRV_SDNNI2 HRV_SDANN5 \\\n",
|
414 |
+
"0 153.515505 NaN NaN NaN NaN NaN \n",
|
415 |
+
"\n",
|
416 |
+
" HRV_SDNNI5 ... HRV_SampEn HRV_ShanEn HRV_FuzzyEn HRV_MSEn HRV_CMSEn \\\n",
|
417 |
+
"0 NaN ... 1.265666 5.657451 1.330316 0.856145 0.9913 \n",
|
418 |
+
"\n",
|
419 |
+
" HRV_RCMSEn HRV_CD HRV_HFD HRV_KFD HRV_LZC \n",
|
420 |
+
"0 1.267671 1.82538 2.016523 2.937446 1.227977 \n",
|
421 |
+
"\n",
|
422 |
+
"[1 rows x 84 columns]"
|
423 |
+
]
|
424 |
+
},
|
425 |
+
"execution_count": 4,
|
426 |
+
"metadata": {},
|
427 |
+
"output_type": "execute_result"
|
428 |
+
}
|
429 |
+
],
|
430 |
"source": [
|
431 |
"file_path = \"./Data/hr_rr_Elias-Rec_1703_162053.csv\"\n",
|
432 |
+
"result = rpeak2hrv_pipeline(inputs=file_path, windowing_method=\"first_interval\", window_size=\"60s\", sampling_rate=1000)\n",
|
433 |
"result.head()"
|
434 |
]
|
435 |
},
|
|
|
478 |
"name": "python3"
|
479 |
},
|
480 |
"language_info": {
|
481 |
+
"codemirror_mode": {
|
482 |
+
"name": "ipython",
|
483 |
+
"version": 3
|
484 |
+
},
|
485 |
+
"file_extension": ".py",
|
486 |
+
"mimetype": "text/x-python",
|
487 |
"name": "python",
|
488 |
+
"nbconvert_exporter": "python",
|
489 |
+
"pygments_lexer": "ipython3",
|
490 |
+
"version": "3.11.6"
|
491 |
}
|
492 |
},
|
493 |
"nbformat": 4,
|