added subset filtering to notebook

This commit is contained in:
Michael Weig 2026-01-24 19:15:31 +01:00
parent 29d70ce713
commit ee648f9adc

View File

@ -37,7 +37,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"dataset_path = Path(r\"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/combined_dataset_25hz.parquet\")" "dataset_path = Path(r\"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/combined_dataset_25hz.parquet\")\n",
"# dataset_path = Path(r\"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/60s_combined_dataset_25hz.parquet\")\n",
"# dataset_path = Path(r\"/home/jovyan/data-paulusjafahrsimulator-gpu/new_datasets/120s_combined_dataset_25hz.parquet\")"
] ]
}, },
{ {
@ -50,7 +52,8 @@
"FILTER_MAD = True\n", "FILTER_MAD = True\n",
"THRESHOLD = 3.5\n", "THRESHOLD = 3.5\n",
"METHOD = 'minmax'\n", "METHOD = 'minmax'\n",
"SCOPE = 'subject'" "SCOPE = 'subject'\n",
"FILTER_SUBSETS = True"
] ]
}, },
{ {
@ -72,6 +75,43 @@
"df.shape" "df.shape"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "3ba4401c",
"metadata": {},
"outputs": [],
"source": [
"if(FILTER_SUBSETS):\n",
" # Special filter: Keep only specific subsets\n",
"# - k-drive L1 baseline\n",
"# - n-back L1 baseline \n",
"# - k-drive test with levels 1, 2, 3\n",
"\n",
" df = df[\n",
" (\n",
" # k-drive L1 baseline\n",
" ((df['STUDY'] == 'k-drive') & \n",
" (df['LEVEL'] == 1) & \n",
" (df['PHASE'] == 'baseline'))\n",
" ) | \n",
" (\n",
" # n-back L1 baseline\n",
" ((df['STUDY'] == 'n-back') & \n",
" (df['LEVEL'] == 1) & \n",
" (df['PHASE'] == 'baseline'))\n",
" ) | \n",
" (\n",
" # k-drive test with levels 1, 2, 3\n",
" ((df['STUDY'] == 'k-drive') & \n",
" (df['LEVEL'].isin([1, 2, 3])) & \n",
" (df['PHASE'] == 'test'))\n",
" )].copy()\n",
"\n",
"print(f\"Filtered dataframe shape: {df.shape}\")\n",
"print(f\"Remaining subsets: {df.groupby(['STUDY', 'LEVEL', 'PHASE']).size()}\")"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,