BaseLRDetector#
- class mobgap.lrd.base.BaseLRDetector[source]#
Base class for L/R foot detectors.
This base class should be used for all Left/Right foot detection algorithms. Algorithms should implement the
detectmethod, which will perform all relevant processing steps. The method should then return the instance of the class, with theic_lr_list_attribute set to theic_listprovided by the used with a new additionlrcolumn that either contains the stringleftorright, indicating the laterality of the initial contact.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 passed to the
detectmethod.- ic_list
The list of initial contacts passed to the
detectmethod.- sampling_rate_hz
The sampling rate of the IMU data in Hz passed to the
detectmethod.
- 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 thelrcolumn added. Thelrcolumn specifies if the respective IC belongs to the left or the right foot.
Notes
You can use the
base_lrd_docfillerdecorator 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, 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__(*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( ) 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_listis expected to have a columnicwith 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.