apply_thresholds#

mobgap.aggregation.apply_thresholds(
input_data: DataFrame,
thresholds: DataFrame,
*,
cohort: str,
height_m: float | None,
measurement_condition: Literal['free_living', 'laboratory'],
check_against: Sequence[Literal['literature', 'global']] = ('literature', 'global'),
) DataFrame[source]#

Apply DMO thresholds to input data and return a DataFrame check whether each data point is within the threshold.

All thresholds are inclusive to the maximum and minimum values. To understand how the thresholds DataFrame is structured, please refer to the documentation of the function get_mobilised_dmo_thresholds.

In addition to the provided thresholds, the function also calculates the maximum allowable stride length based on the participant’s height using a simple model (See Notes). If you don’t want to use this feature, you can set the height to None.

Parameters:
input_data

Input data containing columns ‘cadence_spm’, ‘walking_speed_mps’, ‘stride_length_m’, ‘stride_duration_s’.

thresholds

DMO thresholds data. This is a dataframe with a multi-level index, where the first level is DMO type and the second level is the cohort. The columns are also a multi-level index with the first level being the “type” of threshold, indicating from where the threshold was derived (e.g. “literature”, “global”, “free_living”, “laboratory”) and the second level being the actual threshold type (“min”, “max”).

cohort

Cohort identifier for filtering thresholds.

height_m

Participant’s height in meters. Set to None if you don’t want to use the height based stride length threshold.

measurement_condition

The measurement condition the data was recorded in. This is used to select one of the threshold columns.

check_against

Additional thresholds to check against in addition to the measured condition thresholds. Defaults to (“literature”, “global”). The exact options available might depend on the thresholds provided in the input data.

Returns:
pd.DataFrame

Boolean DataFrame indicating whether each data point is within the thresholds. For values in columns, for which no thresholds were provided this df contains NaN values indicating no checks were applied.

Notes

The height threshold uses an equation from [1] to calculate the leg length from the participant’s height and then estimates the maximal allowable gait speed according to [2] considering a Froude number of 1. Then we use [3] to calculate the maximal vertical displacement of the center of mass during walking at that speed. The maximal allowable stride length is then calculated using the inverted pendulum model introduced by Zijlstra et al..

[1]

Biomechanics and Motor Control of Human Movement, Winter 2009

[2]

Ivanenko YP, Cappellini G, Dominici N, Poppele RE, Lacquaniti F. Modular control of limb movements during human locomotion. J Neurosci. 2007 Oct 10;27(41):11149-61. doi: 10.1523/JNEUROSCI.2644-07.2007. PMID: 17928457; PMCID: PMC6672838.

[3]

S. C. Miff, S. A. Gard and D. S. Childress, “The effect of step length, cadence, and walking speed on the trunk’s vertical excursion,” Proceedings of the 22nd Annual International Conference of the IEEE Engineering in Medicine and Biology Society (Cat. No.00CH37143), Chicago, IL, USA, 2000, pp. 155-158 vol.1, doi: 10.1109/IEMBS.2000.900692.

Examples using mobgap.aggregation.apply_thresholds#

Custom Data and Datasets

Custom Data and Datasets

The Mobilise-D pipeline: Step-by-Step Breakdown

The Mobilise-D pipeline: Step-by-Step Breakdown

Mobilised Aggregator

Mobilised Aggregator

Threshold Checker

Threshold Checker