This notebook is used to interactively choose the best parameters for identifying the gait landmarks in each trial.
import sys
sys.path.append('..')
from IPython.html.widgets import interactive
from IPython.display import display
from IPython.core.pylabtools import figsize
from gaitanalysis.gait import WalkingData
from src import utils
%matplotlib inline
trial_directory = utils.trial_data_dir()
Trials data directory is set to /home/moorepants/Data/human-gait/gait-control-identification
utils.generate_meta_data_table(trial_directory).sort('id').head()
datetime | id | nominal-speed | notes | subject-id | |
---|---|---|---|---|---|
72 | 2013-12-03 05:06:00 | 1 | NaN | This is a trial that Obinna collected for his ... | 1 |
20 | 2013-10-22 | 3 | 1.2 | This is an unloaded trial (no subject) of the ... | 0 |
35 | 2013-10-22 | 4 | 1.2 | This is an unloaded trial (no subject) of the ... | 0 |
44 | 2013-10-22 | 5 | 1.2 | This is an unloaded trial (no subject) of the ... | 0 |
27 | 2013-10-22 | 6 | 1.2 | This is the first attempt at the 10 minute pro... | 1 |
walking_data, walking_data_path = utils.before_finding_landmarks('078')
Trials data directory is set to /home/moorepants/Data/human-gait/gait-control-identification Temporary data directory is set to ../data Loading pre-cleaned data: ../data/cleaned-data-078-longitudinal-perturbation.h5 0.15 s Loading pre-computed inverse dynamics from ../data/walking-data-078-longitudinal-perturbation.h5. 1.20 s
window = 1000
last_index = len(walking_data.raw_data) - window
def plot_landmarks(filter_frequency=10.0, threshold=25.0, index=0):
walking_data.grf_landmarks('FP2.ForY', 'FP1.ForY',
filter_frequency=filter_frequency, threshold=threshold)
axes = walking_data.plot_landmarks(['FP2.ForY'], 'right', index=index, window=window)
figsize(14, 6)
w = interactive(plot_landmarks, filter_frequency=(0.0, 50.0, 1.0),
threshold=(0.0, 70.0, 1.0), index=(0, last_index, window))
w.msg_throttle = 0
display(w)
w.kwargs
{u'filter_frequency': 6.0, u'index': 47003, u'threshold': 61.0}
steps, walking_data = utils.section_signals_into_steps(walking_data, walking_data_path,
force=True,
filter_frequency=w.kwargs['filter_frequency'],
threshold=w.kwargs['threshold'])
Finding the ground reaction force landmarks. 0.15 s Spliting the data into steps. 21.08 s
axes = walking_data.plot_steps('FP2.ForY', 'Right.Ankle.PlantarFlexion.Moment', 'RGTRO.PosY')
axes = walking_data.step_data['Number of Samples'].hist(bins=50)
ticks = axes.xaxis.set_ticks(range(65, 160, 5))
import matplotlib.pyplot as plt
plt.xlim((65, 150))
(65, 150)