.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/parameters/temporal_parameters.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_parameters_temporal_parameters.py: .. _example_temporal_parameters: Temporal parameters calculation =============================== This example illustrates how temporal parameters can be calculated for each stride by the :class:`~gaitmap.parameters.TemporalParameterCalculation`. .. GENERATED FROM PYTHON SOURCE LINES 12-16 Getting stride list -------------------------- For this we need stride event list that can be obtained from event detection method. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: default from gaitmap.example_data import get_healthy_example_stride_events from gaitmap.parameters import TemporalParameterCalculation stride_list = get_healthy_example_stride_events() .. GENERATED FROM PYTHON SOURCE LINES 22-26 Creating TemporalParameterCalculation object -------------------------------------------- We need this object for calculating the temporal parameters. Temporal parameters are calculated based on ic and tc events .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: default p = TemporalParameterCalculation() p = p.calculate(stride_event_list=stride_list, sampling_rate_hz=204.8) .. GENERATED FROM PYTHON SOURCE LINES 31-36 Inspecting the results ---------------------- The main output is the `parameters_`, which contains the temporal parameters for each stride in format of data frame in case of single sensor or dictionary of data frames for multiple sensors. As our passed stride_list here consists of two sensors, the output will be a dictionary. .. GENERATED FROM PYTHON SOURCE LINES 36-38 .. code-block:: default p.parameters_["left_sensor"] .. raw:: html
stride_time swing_time stance_time
s_id
0 1.069336 0.346680 0.722656
1 1.074219 0.361328 0.712891
2 1.069336 0.351562 0.717773
3 1.069336 0.351562 0.717773
4 1.049805 0.351562 0.698242
5 1.049805 0.351562 0.698242
6 1.049805 0.351562 0.698242
7 1.069336 0.361328 0.708008
8 1.079102 0.346680 0.732422
9 1.079102 0.356445 0.722656
10 1.103516 0.351562 0.751953
11 1.098633 0.361328 0.737305
12 1.152344 0.371094 0.781250
13 2.275391 1.499023 0.776367
14 1.162109 0.380859 0.781250
15 1.098633 0.356445 0.742188
16 1.069336 0.356445 0.712891
17 1.083984 0.361328 0.722656
18 1.059570 0.351562 0.708008
19 1.079102 0.351562 0.727539
20 1.088867 0.351562 0.737305
21 1.088867 0.346680 0.742188
22 1.103516 0.361328 0.742188
23 1.108398 0.380859 0.727539
24 1.108398 0.356445 0.751953
25 1.123047 0.371094 0.751953
26 1.127930 0.361328 0.766602
27 1.132812 0.371094 0.761719


.. GENERATED FROM PYTHON SOURCE LINES 39-40 `parameters_pretty_` is another version of `parameters_` but using human readable column names that indicate units. .. GENERATED FROM PYTHON SOURCE LINES 40-41 .. code-block:: default p.parameters_pretty_["left_sensor"] .. raw:: html
stride time [s] swing time [s] stance time [s]
stride id
0 1.069336 0.346680 0.722656
1 1.074219 0.361328 0.712891
2 1.069336 0.351562 0.717773
3 1.069336 0.351562 0.717773
4 1.049805 0.351562 0.698242
5 1.049805 0.351562 0.698242
6 1.049805 0.351562 0.698242
7 1.069336 0.361328 0.708008
8 1.079102 0.346680 0.732422
9 1.079102 0.356445 0.722656
10 1.103516 0.351562 0.751953
11 1.098633 0.361328 0.737305
12 1.152344 0.371094 0.781250
13 2.275391 1.499023 0.776367
14 1.162109 0.380859 0.781250
15 1.098633 0.356445 0.742188
16 1.069336 0.356445 0.712891
17 1.083984 0.361328 0.722656
18 1.059570 0.351562 0.708008
19 1.079102 0.351562 0.727539
20 1.088867 0.351562 0.737305
21 1.088867 0.346680 0.742188
22 1.103516 0.361328 0.742188
23 1.108398 0.380859 0.727539
24 1.108398 0.356445 0.751953
25 1.123047 0.371094 0.751953
26 1.127930 0.361328 0.766602
27 1.132812 0.371094 0.761719


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.603 seconds) **Estimated memory usage:** 9 MB .. _sphx_glr_download_auto_examples_parameters_temporal_parameters.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: temporal_parameters.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: temporal_parameters.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_