dispel.providers.generic.tasks.gait.lee module#

Step detection module specific to Lee et al. algorithm.

This module contains functionality to perform step detection with a revisited version of the Lee et al. algorithm.

dispel.providers.generic.tasks.gait.lee.ALPHA = 4#

Parameter \(\alpha\) is a magnitude constant that should be assigned so as not to disturb the peak or valley detection due to large step deviation during step mode change, especially from running to walking.

dispel.providers.generic.tasks.gait.lee.BETA = 0.3333333333333333#

Parameter \(\beta\) is a time scale constant that should be assigned with M. It is used to rescale (as a denominator) the standard deviation of the last M peak or valley time-intervals when computing the time threshold used to accept or reject any peak or valley candidate.

dispel.providers.generic.tasks.gait.lee.DEFAULT_MU = 0.25#

Default parameter \(\mu\) is used to initiate the average time between two consecutive peaks (valleys) for the last M peaks (valleys).

dispel.providers.generic.tasks.gait.lee.DEFAULT_PEAK_ACC = 1.0#

Default parameter used to initialize the vertical acceleration of a peak.

dispel.providers.generic.tasks.gait.lee.DEFAULT_PEAK_THRESHOLD = 0.025#

Default parameter peak threshold is used to initialize the adaptive time threshold for peaks. This threshold will be used to accept or reject a peak candidate based on the time-interval separating it from the previous peak in addition to other conditions.

dispel.providers.generic.tasks.gait.lee.DEFAULT_SIGMA = 0.0#

Default parameter \(\sigma\) is used to initiate the standard deviation of the time between two consecutive peaks (valleys) for the last M peaks (valleys).

dispel.providers.generic.tasks.gait.lee.DEFAULT_SIGMA_A = 0.0#

Default parameter \(\sigma\) is used to initiate the standard deviation of the vertical acceleration for recent K_SIGMA acceleration samples.

dispel.providers.generic.tasks.gait.lee.DEFAULT_VALLEY_ACC = 0.0#

Default parameter used to initialize the vertical acceleration of a valley.

dispel.providers.generic.tasks.gait.lee.DEFAULT_VALLEY_THRESHOLD = 0.025#

Default parameter valley threshold is used to initialize the valley threshold. This threshold will be used to accept or reject any valley candidates based on the time interval separating it from the previous valley candidate and other conditions.

dispel.providers.generic.tasks.gait.lee.K_SIGMA = 25#

Parameter K_SIGMA should be selected such that the step deviation can reflect the long-term variation in the statistics of the vertical acceleration. The value of 25 is assigned to K to cover one step cycle in normal walking speed with the sampling rate of 50 Hz.

dispel.providers.generic.tasks.gait.lee.LEE_MOD = Lee algorithm (lee)#

A modality indicating something has been computed with Lee algorithm.

class dispel.providers.generic.tasks.gait.lee.LeeDetectSteps[source]#

Bases: DetectStepsProcessingBase

Detect steps using Lee et al. algorithm on vertical acceleration.

new_data_set_id: str = 'lee_with_walking_bouts'#
static step_detection_method(data)[source]#

Define and declare the step detection as a static method.

Parameters:

data (DataFrame) –

Return type:

DataFrame

class dispel.providers.generic.tasks.gait.lee.LeeDetectStepsWithoutBout[source]#

Bases: DetectStepsWithoutBoutsBase

Detect steps using Lee et al. algorithm on vertical acceleration.

data_set_ids: str | Iterable[str] = 'vertical_acceleration'#

An iterable of data sets to be being processed

new_data_set_id: str = 'lee'#
transform_function()#

Run step Detection Algorithm from Lee et al. and format the results.

We use a revisited Lee et al. algorithm since we don’t perform step detection on the acceleration norm but on the vertical acceleration. The results are formatted to return a generic data frame with the following columns: timestamp, event, foot. Where event annotate what is happening as in Bourke et al. doi:10.3390/s20205906.

Parameters:

data (DataFrame) – A data frame containing a column ‘vertical_acc’ referring to the vertical acceleration.

Returns:

A pandas data frame with columns event, foot and timestamp.

Return type:

pandas.DataFrame

class dispel.providers.generic.tasks.gait.lee.LeeHipRotation[source]#

Bases: ExtractHipRotation

Extract Hip Rotation.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeHipRotationWithoutBout[source]#

Bases: ExtractHipRotationWithoutBouts

Extract Hip Rotation.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeMeasuresGroup[source]#

Bases: ProcessingStepGroup

Extract Lee measures based on Lee Steps and a bout strategy.

__init__(bout_strategy, **kwargs)[source]#
Parameters:

bout_strategy (BoutStrategyModality) –

class dispel.providers.generic.tasks.gait.lee.LeeMeasuresWithoutBoutGroup[source]#

Bases: ProcessingStepGroup

Extract Lee measures based on Lee Steps and a bout strategy.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepCount[source]#

Bases: ExtractStepCount

Extract step count.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepCountWithoutBout[source]#

Bases: ExtractStep

Extract step count with lee dataset without walking bouts.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepDur[source]#

Bases: ExtractStepDurationAll

Extract step power.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepDurWithoutBout[source]#

Bases: AggregateRawDataSetColumn

Extract step duration without walking bout.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepPower[source]#

Bases: ExtractPowerBoutDivSteps

Extract step power.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeStepPowerWithoutBout[source]#

Bases: ExtractStep

Extract step count with lee dataset without walking bouts.

__init__(**kwargs)[source]#
class dispel.providers.generic.tasks.gait.lee.LeeTransformHipRotation[source]#

Bases: HipRotationGroup

Transform for positive and negative hip rotation.

__init__(on_walking_bouts, **kwargs)[source]#
Parameters:

on_walking_bouts (bool) –

dispel.providers.generic.tasks.gait.lee.M_SIGMA = 10#

Parameter M should be selected with \(\beta\) such that the statistics of peak or valley intervals can reflect the time-varying speed of walking or running and the noisy peaks or valleys can be delineated from real peaks or valleys.

class dispel.providers.generic.tasks.gait.lee.StepState[source]#

Bases: IntEnum

Step detection states for Lee et al. algorithm.

INITIAL = -1#
INTMD = 0#
PEAK = 2#
VALLEY = 1#
dispel.providers.generic.tasks.gait.lee.detect_steps(data)[source]#

Run step Detection Algorithm from Lee et al. and format the results.

We use a revisited Lee et al. algorithm since we don’t perform step detection on the acceleration norm but on the vertical acceleration. The results are formatted to return a generic data frame with the following columns: timestamp, event, foot. Where event annotate what is happening as in Bourke et al. doi:10.3390/s20205906.

Parameters:

data (DataFrame) – A data frame containing a column ‘vertical_acc’ referring to the vertical acceleration.

Returns:

A pandas data frame with columns event, foot and timestamp.

Return type:

pandas.DataFrame