Skip to content

Commit

Permalink
Merge pull request #64 from biomarkersParkinson/gait_paper
Browse files Browse the repository at this point in the history
Gait paper
  • Loading branch information
Erikpostt authored Oct 15, 2024
2 parents cbf031c + 2a74a45 commit 5a35c83
Show file tree
Hide file tree
Showing 14 changed files with 363 additions and 456 deletions.
342 changes: 172 additions & 170 deletions docs/notebooks/gait/gait_analysis.ipynb
Original file line number Diff line number Diff line change
@@ -1,173 +1,175 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Gait analysis"
]
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Gait analysis"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Automatically reload modules\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import os\n",
"from paradigma.preprocessing_config import IMUPreprocessingConfig\n",
"from paradigma.gait.gait_analysis import extract_gait_features_io, detect_gait_io, extract_arm_swing_features_io, detect_arm_swing_io, quantify_arm_swing_io\n",
"from paradigma.gait.gait_analysis_config import GaitFeatureExtractionConfig, GaitDetectionConfig, ArmSwingFeatureExtractionConfig, ArmSwingDetectionConfig, ArmSwingQuantificationConfig\n",
"from paradigma.imu_preprocessing import preprocess_imu_data_io"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"branch = 'gait'\n",
"sensor = 'imu'\n",
"\n",
"path_to_data = '../../../tests/data'\n",
"path_to_classifier = os.path.join(path_to_data, '0.classifiers', branch)\n",
"path_to_sensor_data = os.path.join(path_to_data, '1.sensor_data', sensor)\n",
"path_to_preprocessed_data = os.path.join(path_to_data, '2.preprocessed_data', sensor)\n",
"path_to_extracted_features = os.path.join(path_to_data, '3.extracted_features', branch)\n",
"path_to_predictions = os.path.join(path_to_data, '4.predictions', branch)\n",
"path_to_quantification = os.path.join(path_to_data, '5.quantification', branch)\n",
"\n",
"# Cell has the tag 'parameters', so it won't overwrite the parameters when running the notebook in tests"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preprocessing"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"config = IMUPreprocessingConfig()\n",
"preprocess_imu_data_io(path_to_sensor_data, path_to_preprocessed_data, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Extract gait features"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"config = GaitFeatureExtractionConfig()\n",
"extract_gait_features_io(path_to_preprocessed_data, path_to_extracted_features, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Detect gait"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"config = GaitDetectionConfig()\n",
"detect_gait_io(path_to_extracted_features, path_to_predictions, path_to_classifier, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Extract arm swing features"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingFeatureExtractionConfig()\n",
"extract_arm_swing_features_io(path_to_preprocessed_data, path_to_extracted_features, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Detect arm swing"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingDetectionConfig()\n",
"detect_arm_swing_io(path_to_extracted_features, path_to_predictions, path_to_classifier, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Quantify arm swing"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingQuantificationConfig()\n",
"quantify_arm_swing_io(path_to_extracted_features, path_to_predictions, path_to_quantification, config)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "paradigma-Fn6RLG4_-py3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Automatically reload modules\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import os\n",
"from paradigma.preprocessing_config import IMUPreprocessingConfig\n",
"from paradigma.gait.gait_analysis import extract_gait_features_io, detect_gait_io, extract_arm_swing_features_io, detect_arm_swing_io, quantify_arm_swing_io\n",
"from paradigma.gait.gait_analysis_config import GaitFeatureExtractionConfig, GaitDetectionConfig, ArmSwingFeatureExtractionConfig, ArmSwingDetectionConfig, ArmSwingQuantificationConfig\n",
"from paradigma.imu_preprocessing import preprocess_imu_data_io"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"path_to_data = '../../../tests/data'\n",
"path_to_classifier = os.path.join(path_to_data, '0.classifiers', 'gait')\n",
"path_to_sensor_data = os.path.join(path_to_data, '1.sensor_data', 'imu')\n",
"path_to_preprocessed_data = os.path.join(path_to_data, '2.preprocessed_data', 'gait')\n",
"path_to_extracted_features = os.path.join(path_to_data, '3.extracted_features', 'gait')\n",
"path_to_predictions = os.path.join(path_to_data, '4.predictions', 'gait')\n",
"path_to_quantification = os.path.join(path_to_data, '5.quantification', 'gait')\n",
"\n",
"# Cell has the tag 'parameters', so it won't overwrite the parameters when running the notebook in tests"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preprocessing"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"config = IMUPreprocessingConfig()\n",
"preprocess_imu_data_io(path_to_sensor_data, path_to_preprocessed_data, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Extract gait features"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"config = GaitFeatureExtractionConfig()\n",
"#config.set_sampling_frequency(50)\n",
"extract_gait_features_io(path_to_preprocessed_data, path_to_extracted_features, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Detect gait"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"config = GaitDetectionConfig()\n",
"detect_gait_io(path_to_extracted_features, path_to_predictions, path_to_classifier, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Extract arm swing features"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingFeatureExtractionConfig()\n",
"extract_arm_swing_features_io(path_to_preprocessed_data, path_to_extracted_features, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Detect arm swing"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingDetectionConfig()\n",
"detect_arm_swing_io(path_to_extracted_features, path_to_predictions, path_to_classifier, config)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Quantify arm swing"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"config = ArmSwingQuantificationConfig()\n",
"quantify_arm_swing_io(path_to_extracted_features, path_to_predictions, path_to_quantification, config)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "paradigma-8ps1bg0Z-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 5a35c83

Please sign in to comment.