Gait analysis

# Automatically reload modules
%load_ext autoreload
%autoreload 2

import os
from paradigma.preprocessing_config import IMUPreprocessingConfig
from paradigma.gait_analysis import extract_gait_features, detect_gait, extract_arm_swing_features, detect_arm_swing, quantify_arm_swing
from paradigma.gait_analysis_config import GaitFeatureExtractionConfig, GaitDetectionConfig, ArmSwingFeatureExtractionConfig, ArmSwingDetectionConfig, ArmSwingQuantificationConfig
from paradigma.imu_preprocessing import preprocess_imu_data
path_to_data =  '../../../tests/data'
path_to_classifier = os.path.join(path_to_data, '0.classifiers', 'gait')
path_to_sensor_data = os.path.join(path_to_data, '1.sensor_data', 'imu')
path_to_preprocessed_data = os.path.join(path_to_data, '2.preprocessed_data', 'gait')
path_to_extracted_features = os.path.join(path_to_data, '3.extracted_features', 'gait')
path_to_predictions = os.path.join(path_to_data, '4.predictions', 'gait')
path_to_quantification = os.path.join(path_to_data, '5.quantification', 'gait')

# Cell has the tag 'parameters', so it won't overwrite the parameters when running the notebook in tests

Preprocessing

config = IMUPreprocessingConfig()
preprocess_imu_data(path_to_sensor_data, path_to_preprocessed_data, config)

Extract gait features

config = GaitFeatureExtractionConfig()
#config.set_sampling_frequency(50)
extract_gait_features(path_to_preprocessed_data, path_to_extracted_features, config)

Detect gait

config = GaitDetectionConfig()
detect_gait(path_to_extracted_features, path_to_predictions, path_to_classifier, config)

Extract arm swing features

config = ArmSwingFeatureExtractionConfig()
extract_arm_swing_features(path_to_preprocessed_data, path_to_extracted_features, config)

Detect arm swing

config = ArmSwingDetectionConfig()
detect_arm_swing(path_to_extracted_features, path_to_predictions, path_to_classifier, config)

Quantify arm swing

config = ArmSwingQuantificationConfig()
quantify_arm_swing(path_to_extracted_features, path_to_predictions, path_to_quantification, config)