BaseTurnDetector#

class mobgap.turning.base.BaseTurnDetector[source]#

Base class for turn detection algorithms.

This class is meant to be subclassed by turn detection algorithms. Algorithms should implement the detect method to detect turns in the passed data. The detect method should set the turn_list_ attribute to the detected turns.

We allow that subclasses specify further parameters for the detect methods (hence, this baseclass supports **kwargs). However, you should only use them, if you really need them and apply active checks, that they are passed correctly. In 99% of the time, you should add a new parameter to the algorithm itself, instead of adding a new parameter to the detect method.

Other Parameters:
data

The raw IMU data in the body frame passed to the detect method.

sampling_rate_hz

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

Attributes:
turn_list_

The detected turns. The dataframe has the columns “start”, “end”, “duration_s”, “turn_angle_deg”, and “direction”. The “direction” column specifies the direction of the turn as “left” or “right”.

Notes

You can use the base_turn_docfiller decorator to fill common parts of the docstring for your subclass. See the source of this class for an example.

Methods

clone()

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

detect(data, *, sampling_rate_hz, **kwargs)

%(detect_short)s.

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(*args, **kwargs)#
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,
*,
sampling_rate_hz: float,
**kwargs: Unpack[dict[str, Any]],
) Self[source]#

%(detect_short)s.

Parameters:
%(detect_para)s
%(detect_return)s
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.turning.base.BaseTurnDetector#

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

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

ElGohary Turning Algo

ElGohary Turning Algo