update
parent
642431e484
commit
775ff8696c
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -38,22 +38,22 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Reading SB\n",
|
||||
"Reading AFIB\n",
|
||||
"Reading GSVT\n",
|
||||
"Reading AFIB\n",
|
||||
"Reading SR\n",
|
||||
"Reading SB\n",
|
||||
"Number of patients per category:\n",
|
||||
"SB: 16559\n",
|
||||
"AFIB: 9839\n",
|
||||
"GSVT: 948\n",
|
||||
"SR: 9720\n"
|
||||
"AFIB: 9839\n",
|
||||
"SR: 9720\n",
|
||||
"SB: 16559\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -74,7 +74,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -87,15 +87,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: total: 562 ms\n",
|
||||
"Wall time: 1.46 s\n"
|
||||
"CPU times: total: 1.41 s\n",
|
||||
"Wall time: 5.67 s\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -115,15 +115,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: total: 375 ms\n",
|
||||
"Wall time: 1.77 s\n"
|
||||
"CPU times: total: 2.77 s\n",
|
||||
"Wall time: 9.85 s\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -137,15 +137,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: total: 547 ms\n",
|
||||
"Wall time: 1.8 s\n"
|
||||
"CPU times: total: 1.95 s\n",
|
||||
"Wall time: 7.01 s\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -157,15 +157,15 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: total: 391 ms\n",
|
||||
"Wall time: 1.72 s\n"
|
||||
"CPU times: total: 1.97 s\n",
|
||||
"Wall time: 8.91 s\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -186,7 +186,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -204,7 +204,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -217,7 +217,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -239,7 +239,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
@ -266,7 +266,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -294,14 +294,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 29,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"sb_p 854 sb_t 854 sb_clean 854\n"
|
||||
"sb_p 863 sb_t 863 sb_clean 863\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -321,9 +321,22 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "TypeError",
|
||||
"evalue": "slice indices must be integers or None or have an __index__ method",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[30], line 5\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcut_signals\u001b[39m(signals,first_p,first_t):\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [signals[i][first_p[i]:first_t[i]] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(signals))]\n\u001b[1;32m----> 5\u001b[0m sliced_sb \u001b[38;5;241m=\u001b[39m \u001b[43mcut_signals\u001b[49m\u001b[43m(\u001b[49m\u001b[43mclean_sb\u001b[49m\u001b[43m,\u001b[49m\u001b[43mfirst_sb_p_peak\u001b[49m\u001b[43m,\u001b[49m\u001b[43mfirst_sb_t_peak\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 6\u001b[0m sliced_afib \u001b[38;5;241m=\u001b[39m cut_signals(clean_afib,first_afib_p_peak,first_afib_t_peak)\n\u001b[0;32m 7\u001b[0m sliced_sr \u001b[38;5;241m=\u001b[39m cut_signals(clean_sr,first_sr_p_peak,first_sr_t_peak)\n",
|
||||
"Cell \u001b[1;32mIn[30], line 2\u001b[0m, in \u001b[0;36mcut_signals\u001b[1;34m(signals, first_p, first_t)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcut_signals\u001b[39m(signals,first_p,first_t):\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[43msignals\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[43mfirst_p\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m:\u001b[49m\u001b[43mfirst_t\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(signals))]\n",
|
||||
"\u001b[1;31mTypeError\u001b[0m: slice indices must be integers or None or have an __index__ method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def cut_signals(signals,first_p,first_t):\n",
|
||||
" return [signals[i][first_p[i]:first_t[i]] for i in range(len(signals))]\n",
|
||||
|
@ -333,6 +346,15 @@
|
|||
"sliced_afib = cut_signals(clean_afib,first_afib_p_peak,first_afib_t_peak)\n",
|
||||
"sliced_sr = cut_signals(clean_sr,first_sr_p_peak,first_sr_t_peak)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"np.mean(sliced_sb,axis=1)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
Loading…
Reference in New Issue