LrdMcCamley#

class mobgap.lrd.LrdMcCamley(
axis: Literal['yaw', 'roll', 'combined'] = 'combined',
smoothing_filter: BaseFilter = cf(ButterworthFilter(cutoff_freq_hz=(0.5, 2), filter_type='bandpass', order=4, zero_phase=True)),
)[source]#

McCamley algorithm for laterality detection of initial contacts.

The McCamley algorithm [1] uses the sign of the angular velocity either yaw or roll (or a combination of both) as the distinguishing factor for identifying left and right ICs.

For this the respective signal is filtered (high-pass to remove DC offset and low-pass to remove noise) and the sign at the position of the IC is used to determine the laterality.

The original algorithm uses the yaw signal, but Ullrich et al. [2] showed that a combination of yaw and roll signals can improve the detection accuracy. Further, instead of simple mean subtraction, Ullrich et al. [2] used a Butterworth bandpass filter to smooth the signal.

Parameters:
axis

The axis to use for the laterality detection. Can be one of “yaw”, “roll”, or “combined”. For “roll” and “combined” the sign of the “roll” signal is inverted, as it is phase shifted compared to the yaw signal.

smoothing_filter

The filter to use for smoothing the signal. The filter should be a high-pass filter to remove the DC offset and a low-pass filter to remove noise. So any form of bandpass filter should be suitable.

Other Parameters:
data

The raw IMU data passed to the detect method.

ic_list

The list of initial contacts passed to the detect method.

sampling_rate_hz

The sampling rate of the IMU data in Hz passed to the detect method.

Attributes:
ic_lr_list_

A dataframe specifying the detected left and right foot initial contacts. The dataframe is identical to the input ic_list, but with the lr column added. The lr column specifies if the respective IC belongs to the left or the right foot.

smoothed_data_

The smoothed data used for the laterality detection. This might be helpful for debugging or further analysis.

Notes

In the edge case of data == 0, the left side is assumed.

[1]

J. McCamley et al., “An enhanced estimate of initial contact and final contact instants of time using lower trunk inertial sensor data,” Gait & posture, 2012, available at: https://www.sciencedirect.com/science/article/pii/S0966636212000707?via%3Dihub

[2] (1,2)

Ullrich M, Küderle A, Reggi L, Cereatti A, Eskofier BM, Kluge F. Machine learning-based distinction of left and right foot contacts in lower back inertial sensor gait data. Annu Int Conf IEEE Eng Med Biol Soc. 2021, available at: https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9630653

Methods

clone()

Create a new instance of the class with all parameters copied over.

detect(data, ic_list, *, sampling_rate_hz, **_)

Assign a left/right label to each initial contact in the passed data..

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(
axis: Literal['yaw', 'roll', 'combined'] = 'combined',
smoothing_filter: BaseFilter = cf(ButterworthFilter(cutoff_freq_hz=(0.5, 2), filter_type='bandpass', order=4, zero_phase=True)),
) None[source]#
clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

detect(
data: DataFrame,
ic_list: DataFrame,
*,
sampling_rate_hz: float,
**_: Unpack,
) Self[source]#

Assign a left/right label to each initial contact in the passed data..

Parameters:
data

The raw IMU of a single sensor.

ic_list

The list of initial contacts within the data. The ic_list is expected to have a column ic with the indices of the detected initial contacts relative to the start of the passed data.

sampling_rate_hz

The sampling rate of the IMU data in Hz.

Returns:
self

The instance of the class with the ic_lr_list_ attribute set to the detected left/right initial contacts.

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

Examples using mobgap.lrd.LrdMcCamley#

McCamley L/R detector

McCamley L/R detector