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

Core functionality for measure extraction based on continuous wavelet transform.

Part of this module is based on a modified version of GaitPy.

References

Using an Accelerometer on the Lower Back.

class dispel.providers.generic.tasks.gait.cwt.AggregateAllCWTMeasures[source]#

Bases: ProcessingStepGroup

A group of gait processing steps for cwt measures on walking bouts.

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

data_set_id (str) –

class dispel.providers.generic.tasks.gait.cwt.AggregateAllCWTMeasuresWithoutBout[source]#

Bases: ProcessingStepGroup

Group of gait processing steps for cwt measures not on walking bout.

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

data_set_id (str) –

class dispel.providers.generic.tasks.gait.cwt.AggregateCWTMeasure[source]#

Bases: GaitBoutAggregateStep

An Aggregation of cwt measures on walking bouts.

__init__(data_set_id, column_id, **kwargs)[source]#
Parameters:
  • data_set_id (str) –

  • column_id (str) –

class dispel.providers.generic.tasks.gait.cwt.AggregateCWTMeasureWithoutBout[source]#

Bases: AggregateRawDataSetColumn

An Aggregation of cwt measures not on walking bouts.

__init__(data_set_id, column_id, **kwargs)[source]#
Parameters:
  • data_set_id (str) –

  • column_id (str) –

class dispel.providers.generic.tasks.gait.cwt.CWTCountSteps[source]#

Bases: GaitBoutExtractStep

Extract the total number of steps counted with cwt.

__init__(data_set_id, **kwargs)[source]#
class dispel.providers.generic.tasks.gait.cwt.CWTDetectSteps[source]#

Bases: DetectStepsProcessingBase

Detect Initial and Final contact of the foot in vertical acceleration.

This method is based on CWT algorithm which consists in using wavelets transforms to decompose the vertical acceleration signal and the velocity to detect initial and final contacts. It is ran on each of the detected walking bout and then aggregated in a common data frame with an extra columns named bout_id indicating the id of the walking bout. It expects two data set id, the first one linking to the acceleration dataset containing the acceleration with gravity rotated resampled and detrended. The second one linking to the walking bout data set.

new_data_set_id: str = 'cwt_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.cwt.CWTDetectStepsWithoutBout[source]#

Bases: DetectStepsWithoutBoutsBase

Detect Initial and Final contact of the foot without walking bouts.

For more information about the step detection methodology, see: CWTDetectSteps.

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

Detect Initial and Final contact of the foot in vertical acceleration.

This method is based on CWT algorithm which consists in using wavelets transforms to decompose the vertical acceleration signal and the velocity to detect initial and final contacts. It is then formatted to the step data set format.

Parameters:

data (DataFrame) – The vertical acceleration.

Returns:

A data frame of the different gait event annotated under the step data set format with three columns:event, foot and timestamp.

Return type:

pandas.DataFrame

class dispel.providers.generic.tasks.gait.cwt.CWTMeasureTransformation[source]#

Bases: TransformStep

Compute temporal and spatial measures for each gait cycle.

It expects two data set ids, first: The data set id of the cwt step dataset after optimization, with step annotated with IC, FC, FC_opp_foot and GaitCycle and second, the data set id of the height changes of the center of mass.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: IC (Initial Contact)>, <RawDataValueDefinition: FC (Final Contact)>, <RawDataValueDefinition: FC_opp_foot (Final Contact of the opposite foot)>, <RawDataValueDefinition: Gait_Cycle (Gait Cycle)>, <RawDataValueDefinition: bout_id (bout id)>, <RawDataValueDefinition: steps (steps)>, <RawDataValueDefinition: stride_dur (stride duration, s)>, <RawDataValueDefinition: stride_dur_asym (stride duration asymmetry, s)>, <RawDataValueDefinition: stride_dur_asym_ln (stride duration asymmetry (ln))>, <RawDataValueDefinition: step_dur (step dur, s)>, <RawDataValueDefinition: step_dur_asym (step duration asymmetry, s)>, <RawDataValueDefinition: step_dur_asym_ln (step duration asymmetry (ln))>, <RawDataValueDefinition: cadence (cadence)>, <RawDataValueDefinition: init_double_supp (initial double support, s)>, <RawDataValueDefinition: init_double_supp_asym (initial double support asymmetry, s)>, <RawDataValueDefinition: term_double_supp (terminal double support, s)>, <RawDataValueDefinition: term_double_supp_asym (terminal double support asymmetry, s)>, <RawDataValueDefinition: double_supp (double support, s)>, <RawDataValueDefinition: double_supp_asym (double support asymmetry, s)>, <RawDataValueDefinition: single_limb_supp (single limb support, s)>, <RawDataValueDefinition: single_limb_supp_asym (single limb support asymmetry, s)>, <RawDataValueDefinition: stance (stance, s)>, <RawDataValueDefinition: stance_asym (stance asymmetry, s)>, <RawDataValueDefinition: swing (swing, s)>, <RawDataValueDefinition: swing_asym (swing asymmetry, s)>, <RawDataValueDefinition: step_len (step length, m)>, <RawDataValueDefinition: step_len_asym (step length asymmetry, m)>, <RawDataValueDefinition: step_len_asym_ln (step length asymmetry ln)>, <RawDataValueDefinition: stride_len (stride length, m)>, <RawDataValueDefinition: stride_len_asym (stride length asymmetry, m)>, <RawDataValueDefinition: stride_len_asym_ln (stride length asymmetry ln)>, <RawDataValueDefinition: gait_speed (gait speed, m/s)>]#
extract_measures(data, height_changes_com, level)[source]#

Extract cwt measures.

Parameters:
class dispel.providers.generic.tasks.gait.cwt.CWTMeasureWithoutBoutTransformation[source]#

Bases: TransformStep

Compute temporal and spatial measures for each gait cycle.

It expects two data set ids, first: The data set id of the cwt step dataset after optimization, with step annotated with IC, FC, FC_opp_foot and GaitCycle and second, the data set id of the height changes of the center of mass.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: IC (Initial Contact)>, <RawDataValueDefinition: FC (Final Contact)>, <RawDataValueDefinition: FC_opp_foot (Final Contact of the opposite foot)>, <RawDataValueDefinition: Gait_Cycle (Gait Cycle)>, <RawDataValueDefinition: steps (steps)>, <RawDataValueDefinition: stride_dur (stride duration, s)>, <RawDataValueDefinition: stride_dur_asym (stride duration asymmetry, s)>, <RawDataValueDefinition: stride_dur_asym_ln (stride duration asymmetry (ln))>, <RawDataValueDefinition: step_dur (step dur, s)>, <RawDataValueDefinition: step_dur_asym (step duration asymmetry, s)>, <RawDataValueDefinition: step_dur_asym_ln (step duration asymmetry (ln))>, <RawDataValueDefinition: cadence (cadence)>, <RawDataValueDefinition: init_double_supp (initial double support, s)>, <RawDataValueDefinition: init_double_supp_asym (initial double support asymmetry, s)>, <RawDataValueDefinition: term_double_supp (terminal double support, s)>, <RawDataValueDefinition: term_double_supp_asym (terminal double support asymmetry, s)>, <RawDataValueDefinition: double_supp (double support, s)>, <RawDataValueDefinition: double_supp_asym (double support asymmetry, s)>, <RawDataValueDefinition: single_limb_supp (single limb support, s)>, <RawDataValueDefinition: single_limb_supp_asym (single limb support asymmetry, s)>, <RawDataValueDefinition: stance (stance, s)>, <RawDataValueDefinition: stance_asym (stance asymmetry, s)>, <RawDataValueDefinition: swing (swing, s)>, <RawDataValueDefinition: swing_asym (swing asymmetry, s)>, <RawDataValueDefinition: step_len (step length, m)>, <RawDataValueDefinition: step_len_asym (step length asymmetry, m)>, <RawDataValueDefinition: step_len_asym_ln (step length asymmetry ln)>, <RawDataValueDefinition: stride_len (stride length, m)>, <RawDataValueDefinition: stride_len_asym (stride length asymmetry, m)>, <RawDataValueDefinition: stride_len_asym_ln (stride length asymmetry ln)>, <RawDataValueDefinition: gait_speed (gait speed, m/s)>]#
extract_measures(data, height_changes_com, level)[source]#

Extract cwt measures.

Parameters:
class dispel.providers.generic.tasks.gait.cwt.CWTMeasures[source]#

Bases: ProcessingStepGroup

Extract Del Din measures based on CWT Steps and a bout strategy.

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

bout_strategy (BoutStrategyModality) –

class dispel.providers.generic.tasks.gait.cwt.CWTMeasuresWithoutBout[source]#

Bases: ProcessingStepGroup

Extract Del Din measures based on CWT Steps and a bout strategy.

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

Bases: ExtractPowerBoutDivSteps

Extract step power from CWT with walking bouts.

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

Bases: ExtractStep

Extract step power with CWT dataset without walking bouts.

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

Bases: ExtractStep

Extract step count with CWT dataset without walking bouts.

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

Bases: ExtractStepIntensityAll

Extract step intensity for cwt.

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

Bases: AggregateRawDataSetColumn

Extract step intensity without walking bout.

aggregations: AggregationsDefinitionType = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
column_id: str = 'step_intensity'#
data_set_ids: str | Iterable[str] = 'cwt_optimized_step_vigor'#

An iterable of data sets to be being processed

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

class dispel.providers.generic.tasks.gait.cwt.CWTStepPower[source]#

Bases: ExtractStepPowerAll

Extract step power for cwt.

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

Bases: AggregateRawDataSetColumn

Extract step power without walking bout.

aggregations: AggregationsDefinitionType = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), (functools.partial(<function Series.quantile>, q=0.95), '95th percentile')]#
column_id: str = 'step_power'#
data_set_ids: str | Iterable[str] = 'cwt_optimized_step_vigor'#

An iterable of data sets to be being processed

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

class dispel.providers.generic.tasks.gait.cwt.CWTStepRegularity[source]#

Bases: ExtractStepRegularity

Extract step regularity for cwt.

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

Bases: AggregateRawDataSetColumn

Extract step regularity without walking bout.

aggregations: AggregationsDefinitionType = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
column_id: str = 'step_regularity'#
data_set_ids: str | Iterable[str] = 'cwt_optimized_gait_regularity'#

An iterable of data sets to be being processed

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

class dispel.providers.generic.tasks.gait.cwt.CWTStrideRegularity[source]#

Bases: ExtractStrideRegularity

Extract stride regularity for cwt.

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

Bases: AggregateRawDataSetColumn

Extract stride regularity without walking bout.

aggregations: AggregationsDefinitionType = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
column_id: str = 'stride_regularity'#
data_set_ids: str | Iterable[str] = 'cwt_optimized_gait_regularity'#

An iterable of data sets to be being processed

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

dispel.providers.generic.tasks.gait.cwt.CWT_MEASURES_DESC_MAPPING = {'cadence': 'Cadence is defined as the instantaneous number of steps per minutes.', 'double_supp': 'Double support phase is defined as the sum ofthe initial and terminal double support phase.', 'double_supp_asym': 'Double support asymmetry is defined as the absolute difference of the double support duration between the right and left foot.', 'gait_speed': 'Gait speed is defined as the instantaneous walking speed in m/s. It is computed as the length of a stride divided by the duration.', 'init_double_supp': 'Initial double support phase is the sub-phase between heel contact of the phase to contralateral foot-off.', 'init_double_supp_asym': 'Initial double support asymmetry is defined as the absolute difference of the initial double support duration between the right and left foot.', 'single_limb_supp': 'Single limb support represents a phase in the gait cycle when the body weight is entirely supported by one limb, while the contra-lateral limb swings forward.', 'single_limb_supp_asym': 'Single limb support asymmetry is defined as the absolute difference of the single limb support duration between the right and left foot.', 'stance': 'The stance phase of gait begins when the foot first touches the ground and ends when the same foot leaves the ground.', 'stance_asym': 'Stance asymmetry is defined as the absolute difference of the stance duration between the right and left foot.', 'step_dur': 'Step duration is the time elapsed between two consecutive footsteps. More specifically between two consecutive initial contact events.', 'step_dur_asym': 'Step duration asymmetry is defined as the absolute difference of the step duration between the right and left foot.', 'step_dur_asym_ln': 'Step duration asymmetry ln is defined as the natural logarithm of the ratio of the minimum duration to the maximum duration of two consecutive steps.', 'step_len': 'Step length is the distance between the point of initial contact of one foot and the point of initial contact of the opposite foot.', 'step_len_asym': 'Step length asymmetry is defined as the absolute difference of the step length between the right and left foot.', 'step_len_asym_ln': 'Step length asymmetry ln is defined as the natural logarithmof the ratio in the length between consecutive steps.', 'steps': 'Number of steps', 'stride_dur': 'Stride duration is defined as the time elapsed between the first contact of two consecutive footsteps of the same foot.', 'stride_dur_asym': 'Stride duration asymmetry is defined as the absolute difference of the stride duration between the right and left foot.', 'stride_dur_asym_ln': 'Stride duration asymmetry ln is defined as the natural logarithm of the ratio of the minimum duration to the maximum duration of two consecutive strides.', 'stride_len': 'Stride length is the distance covered when you take two steps, one with each foot.', 'stride_len_asym': 'Stride length asymmetry is defined as the absolute difference of the stride length between the right and left foot.', 'stride_len_asym_ln': 'Stride length asymmetry ln is defined as the naturallogarithm of the ratio in the length between consecutive strides.', 'swing': 'The swing phase of gait begins when the foot first leaves the ground and ends when the same foot touches the ground again.', 'swing_asym': 'Swing asymmetry is defined as the absolute difference of the swing duration between the right and left foot.', 'term_double_supp': 'Terminal double support phase is the  sub-phase from contralateral foot-on to the toe-off.', 'term_double_supp_asym': 'Terminal double support asymmetry is defined as the absolute difference of the terminaldouble support duration between the right andleft foot.'}#

Mapping measures to description to help fill the description of cwt measures when aggregating columns.

dispel.providers.generic.tasks.gait.cwt.CWT_MEASURES_PRECISION_MAPPING = {'cadence': 3, 'double_supp': 3, 'double_supp_asym': 3, 'gait_speed': 3, 'init_double_supp': 3, 'init_double_supp_asym': 3, 'single_limb_supp': 3, 'single_limb_supp_asym': 3, 'stance': 3, 'stance_asym': 3, 'step_dur': 3, 'step_dur_asym': 3, 'step_dur_asym_ln': 3, 'step_len': 3, 'step_len_asym': 3, 'step_len_asym_ln': 3, 'steps': None, 'stride_dur': 3, 'stride_dur_asym': 3, 'stride_dur_asym_ln': 3, 'stride_len': 3, 'stride_len_asym': 3, 'stride_len_asym_ln': 3, 'swing': 3, 'swing_asym': 3, 'term_double_supp': 3, 'term_double_supp_asym': 3}#

Mapping measures to precision to map the precision of cwt measures when aggregating columns.

dispel.providers.generic.tasks.gait.cwt.DEFAULT_SENSOR_HEIGHT = 0.901#

A default sensor height given sensor_height ratio and subject height.

dispel.providers.generic.tasks.gait.cwt.DEFAULT_SUBJECT_HEIGHT = 1.7#

A default height that we will use to compute spatial measures until we have access to the correct height.

dispel.providers.generic.tasks.gait.cwt.FINAL_CONTACT_PROMINENCE = 10#

Prominence of a vertical acceleration peak indicating a toe off or foot final contact.

class dispel.providers.generic.tasks.gait.cwt.FootContact[source]#

Bases: IntEnum

Generic foot contact for peak detection.

FINAL_CONTACT = 2#
INITIAL_CONTACT = 1#
class dispel.providers.generic.tasks.gait.cwt.FormatAccelerationCWT[source]#

Bases: ProcessingStepGroup

Format acceleration to vertical acceleration.

columns_with_g = ['acceleration_x', 'acceleration_y', 'acceleration_z']#
data_set_id = 'acc'#
steps: List[ProcessingStep] = [<dispel.providers.generic.sensor.AddGravityAndScale object>, <dispel.providers.generic.preprocessing.RotateFrame object>, <dispel.providers.generic.sensor.Resample object>, <dispel.providers.generic.preprocessing.Detrend object>]#
dispel.providers.generic.tasks.gait.cwt.GAIT_CYCLE_FORWARD_IC = 2.25#

Maximum allowable time (seconds) between initial contact of same foot

class dispel.providers.generic.tasks.gait.cwt.HeightChangeCOM[source]#

Bases: TransformStep

Compute the height changes of the center of mass.

It expects two data set ids, first: the data set id mapping the output of FormatAccelerationCWT and second an id linking to the acceleration dataset containing the acceleration with gravity rotated resampled and detrended.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: height_com (height change center of mass, m)>]#
dispel.providers.generic.tasks.gait.cwt.INITIAL_CONTACT_PROMINENCE = 5#

Prominence of a vertical acceleration peak indicating a heel strike or foot initial contact.

dispel.providers.generic.tasks.gait.cwt.LOADING_FORWARD_IC = 0.45#

Maximum time (seconds) for loading phase.

dispel.providers.generic.tasks.gait.cwt.MIN_FREQ_TO_FILTER = 40#

The minimum sampling frequency at which we start low pass filter before computing the wavelets.

dispel.providers.generic.tasks.gait.cwt.MIN_SAMPLES_HEIGHT_CHANGES_COM = 15#

The minimum number of samples to compute changes of height of the center of mass.

class dispel.providers.generic.tasks.gait.cwt.OptimizeCwtStepDataset[source]#

Bases: TransformStep

Apply physiological constraints to filter impossible gait events.

It expects a unique data set id, linking to the cwt step data set.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: IC (Initial Contact)>, <RawDataValueDefinition: FC (Final Contact)>, <RawDataValueDefinition: FC_opp_foot (Final Contact of the opposite foot)>, <RawDataValueDefinition: Gait_Cycle (Gait Cycle)>, <RawDataValueDefinition: bout_id (bout id)>]#
get_new_data_set_id()[source]#

Overwrite new_data_set_id.

Return type:

str

class dispel.providers.generic.tasks.gait.cwt.OptimizeCwtStepDatasetWithoutWalkingBout[source]#

Bases: TransformStep

Apply physiological constraints to filter impossible gait events.

It expects a unique data set id, linking to the cwt step data set without walking bouts.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: IC (Initial Contact)>, <RawDataValueDefinition: FC (Final Contact)>, <RawDataValueDefinition: FC_opp_foot (Final Contact of the opposite foot)>, <RawDataValueDefinition: Gait_Cycle (Gait Cycle)>]#
get_new_data_set_id()[source]#

Overwrite new_data_set_id.

Return type:

str

transform_function()#

Apply physiological constraints to filter impossible gait events.

Several optimization steps are applied to the cwt step dataset. The first optimization implies constraint on times. Maximum allowable time are defined for: loading phases (each initial contact requires 1 forward final contact within 0.225 seconds) and stance phases (each initial contact requires at least 2 forward final contact’s within 1.35 second) and entire gait cycles (each initial contact requires at least 2 initial contacts within 2.25 seconds after).

Parameters:

cwt_step (DataFrame) – The step dataset computed applying CWT wavelet transforms and peak detection.

Returns:

A data frame with optimized gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.SENSOR_HEIGHT_RATIO = 0.53#

Height of the sensor relative to subject height.

dispel.providers.generic.tasks.gait.cwt.STANCE_FORWARD_IC = 1.575#

Maximum time (seconds) for stance phase.

dispel.providers.generic.tasks.gait.cwt.STEP_LENGTH_HEIGHT_RATIO = 0.41#

Average step length relative to subject height.

dispel.providers.generic.tasks.gait.cwt.compute_asymmetry(data)[source]#

Compute absolute asymmetry.

Parameters:

data (Series) – The cyclic property dataset to be analyzed.

Returns:

A pandas Series containing the absolute difference between consecutive items of the dataset.

Return type:

pandas.Series

dispel.providers.generic.tasks.gait.cwt.compute_double_support(data)[source]#

Compute double support and double support asymmetry.

Double support phase is defined as the sum of the initial and terminal double support phase. This makes up approximately 28-40% of the stance phase.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with double support and double support asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_gait_speed(data)[source]#

Compute gait speed.

Gait speed is defined as the instantaneous walking speed in m/s. It is computed as the length of a stride divided by the duration.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with step velocity added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_initial_double_support(data)[source]#

Compute initial double support and initial double support asymmetry.

Initial double support phase is the sub-phase between heel contact of the phase to contralateral foot-off. This phase makes up approximately 14-20% of the stance phase.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with initial double support and initial double support asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_ln_asymmetry(data)[source]#

Compute natural logarithm of asymmetry ratio.

Parameters:

data (Series) – The cyclic property dataset to be analyzed.

Returns:

A pandas Series containing the natural logarithm of the ratio of the minimum and maximum cyclic property, denoting normalized asymmetry.

Return type:

pandas.Series

dispel.providers.generic.tasks.gait.cwt.compute_single_limb_support(data)[source]#

Compute single limb support and single limb support asymmetry.

Single limb support represents a phase in the gait cycle when the body weight is entirely supported by one limb, while the contra-lateral limb swings forward.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with single limb support and single limb support asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_stance(data)[source]#

Compute stance and stance asymmetry.

The stance phase of gait begins when the foot first touches the ground and ends when the same foot leaves the ground. The stance phase makes up approximately 60% of the gait cycle. It can also be seen as the time elapsed between the final contact and initial contact. The asymmetry is defined as the difference of the measure between the right and left foot. It is given as an absolute difference as we don’t know which foot is which.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with stride duration and stride duration asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_step_duration_and_cadence(data)[source]#

Compute step duration, step duration asymmetry and cadence.

Step duration is the time elapsed between two consecutive footsteps. More specifically between two consecutive initial contact events. The asymmetry is defined as the difference of the measure between the right and left foot. It is given as an absolute difference as we don’t know which foot is which. Cadence is defined as the instantaneous number of steps per minutes.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

A data frame with step duration, step duration asymmetry and cadence for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_step_length(data, height_changes_com, sensor_height)[source]#

Compute step length and step length asymmetry.

Step length is the distance between the point of initial contact of one foot and the point of initial contact of the opposite foot.

Parameters:
  • data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

  • height_changes_com (Series) – A panda series with the changes in height of the center of mass.

  • sensor_height (float) – The height of the smartphone sensor in meters when located at the lumbar position.

Returns:

Input data frame with step length and step length asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_stride_duration(data)[source]#

Compute stride duration and stride duration asymmetry.

Stride duration is defined as the time elapsed between the first contact of two consecutive footsteps of the same foot. The asymmetry is defined as the difference of the measure between the right and left foot. It is given as an absolute difference as we don’t know which foot is which.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

A data frame with stride duration and stride duration asymmetry for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_stride_length(data)[source]#

Compute stride length and stride length asymmetry.

Stride length is the distance covered when you take two steps, one with each foot.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with stride length and stride length asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_swing(data)[source]#

Compute swing and swing asymmetry.

The swing phase of gait begins when the foot first leaves the ground and ends when the same foot touches the ground again. The swing phase makes up 40% of the gait cycle.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with swing and swing asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.compute_terminal_double_support(data)[source]#

Compute terminal double support and terminal double support asymmetry.

Terminal double support phase is the sub-phase from contralateral foot-on to the toe-off. This phase makes up approximately 14-20% of the stance phase.

Parameters:

data (DataFrame) – The cwt_optimized with step events output of the TransformStep OptimizeCwtStepDataset.

Returns:

Input data frame with terminal double support and terminal double support asymmetry added for each valid gait cycle.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.cwt_step_detection(data)[source]#

Detect Initial and Final contact of the foot in vertical acceleration.

This method is based on CWT algorithm which consists in using wavelets transforms to decompose the vertical acceleration signal and the velocity to detect initial and final contacts. It is then formatted to the step data set format.

Parameters:

data (DataFrame) – The vertical acceleration.

Returns:

A data frame of the different gait event annotated under the step data set format with three columns:event, foot and timestamp.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.gait.cwt.get_sensor_height(context)[source]#

Get sensor height from context if available else return default.

Parameters:

context (Context) –

Return type:

float

dispel.providers.generic.tasks.gait.cwt.get_subject_height(context)[source]#

Get subject height from context if available else return default.

Parameters:

context (Context) –

Return type:

float