WsNaive#
- class mobgap.walking_speed.WsNaive[source]#
Naive walking speed calculation from cadence and stride length.
This “algorithm” calculates the walking speed from the cadence and stride length, ignoring any other factors. The internal equation looks as follows:
\[\text{{walking speed}} = \frac{{\text{{stride length}} * \text{{cadence}}}}{60 * 2}\]We assume that the stride length is in meters and the cadence in steps per minute. Then we divide by 60 to get steps per second and by 2 to convert from steps per sec to strides per sec. Then we multiply by the stride length, getting the walking speed in meters per second.
- Other Parameters:
- data
The raw IMU data of the gait sequence passed to the
calculatemethod.- initial_contacts
The initial contacts passed to the
calculatemethod.- cadence_per_sec
The cadence values provided to the
calculatemethod.- stride_length_per_sec
The stride length values provided to the
calculatemethod.- sampling_rate_hz
The sampling rate of the IMU data in Hz passed to the
calculatemethod.
- Attributes:
- walking_speed_per_sec_
The main output of the walking speed calculation. It provides a DataFrame with the column
walking_speed_mpsthat contains the walking speed values with one value per full second of the provided data. The unit ism/s. The index of this dataframe is namedsec_center_samplesand contains the sample number of the center of the each second.
Methods
calculate(data, *[, initial_contacts, ...])Calculate per-sec walking speed values in the passed data..
clone()Create a new instance of the class with all parameters copied over.
get_params([deep])Get parameters for this algorithm.
set_params(**params)Set the parameters of this Algorithm.
- __init__(*args, **kwargs)#
- calculate(
- data: DataFrame,
- *,
- initial_contacts: DataFrame | None = None,
- cadence_per_sec: DataFrame | None = None,
- stride_length_per_sec: DataFrame | None = None,
- sampling_rate_hz: float,
- **_: Unpack[dict[str, Any]],
Calculate per-sec walking speed values in the passed data..
- Parameters:
- data
The raw IMU data of a single sensor. We usually assume that this is one gait sequence (i.e. that there are no non-walking periods in the data).
- initial_contacts
The initial contacts of the gait sequence. This should be passed as a DataFrame with the colum
icthat contains the sample number of the initial contacts. We usually assume that the first IC marks the start of the passed gait sequence and the last IC marks the end.- cadence_per_sec
The cadence per sec within the gait sequence. This should be a DataFrame with a
cadence_spmcolumn containing one cadence value per second in the GS.- stride_length_per_sec
This should be a DataFrame with a
stride_length_mcolumn containing one stride length value per second in the GS.- sampling_rate_hz
The sampling rate of the IMU data in Hz.
- Returns:
- self
The instance of the class with the
walking_speed_per_sec_attribute set to the estimated walking speed per second values.
- 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
- 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.