gaitmap.parameters.SpatialParameterCalculation#
- class gaitmap.parameters.SpatialParameterCalculation(calculate_only: Sequence[Literal['stride_length', 'gait_velocity', 'max_orientation_change', 'ic_angle', 'tc_angle', 'turning_angle', 'arc_length', 'max_sensor_lift', 'max_lateral_excursion']] | None = None, expected_stride_type: Literal['min_vel', 'ic'] = 'min_vel')[source]#
Calculating spatial parameters of strides based on extracted gait events and foot trajectories.
Calculations are based on [1] and [2].
- Parameters:
- calculate_only
List of parameters to be calculated. If None, all parameters are calculated. Even, if all parameters are calculated, we will check for the existence of the required data.
- expected_stride_type
The expected stride type of the stride list. This can either be “min_vel” or “ic”. This effects how the events are used to calculate the stride time required for the gait velocity calculation. For more details see
TemporalParameterCalculation.
- Other Parameters:
- stride_event_list
Gait events for each stride obtained from event detection as type
min_vel-stride list.- positions
position of the sensor at each time point as estimated by trajectory reconstruction.
- orientations
orientation of the sensor at each time point as estimated by trajectory reconstruction.
- sampling_rate_hz
The sampling rate of the data signal.
- Attributes:
- parameters_
Data frame containing spatial parameters for each stride in case of single sensor or dictionary of data frames in multi sensors. It has the same structure as the provided stride list
parameters_pretty_Return parameters with column names indicating units.
- sole_angle_course_
The sole angle of all strides over time. It has the same structure as the provided position list.
See also
gaitmap.parameters.TemporalParameterCalculationCalculate temporal parameters
Notes
- Stride Length
The stride length is calculated based on the pythagoras in the floor plane (x, y - plane)
- Gait Velocity
The gait velocity is calculated by dividing the stride length by the stride time. Note, that the stride time is calculated from
pre_ictoicif amin_veltype stride list is provided. The stride is estimated based on the position at thestartand theendof a stride. This means these two measures are calculated from different time periods which might lead to errors in certain edge cases.- Arc Length
The overall arc length is directly calculated from the position of the sensor by adding the absolute changes in position at every time point.
- Max. orientation change
The maximum change of sensor angle in the sagittal plane. This is similar to the range of motion of the ankle, however, the measured parameter is effected by other joints such as knee and hip as well.
- Turning Angle
The turning angle is calculated as the difference in orientation of the forward direction between the first and the last sample of each stride. Only the rotation around the z-axis (upwards) is considered. A turn to the left results in a positive and a turn to the right in a negative turning angle independent of the foot.
- IC/TC Angle and angle course
All angles are calculated as the angle between the forward direction ([1, 0, 0] from the sensor frame transformed into the world frame, using the provided orientations) and the floor. The angle is positive if the vector is pointing upwards (i.e. the toe is higher than the heel) and negative if the angle is pointing downwards (i.e. the heel is higher than the toe), following the convetion in [1]. The sole angle is assumed to be 0 during midstance. The IC and TC angles are simply the sole angles at the respective time points.
- Max. Sensor Lift
The maximal relative height (relative to the height at midstance) the sensor reaches during the stride. Note that this is not equivalent to the actual foot lift/toe clearance. These values can be estimated, if the postion of the sensor on the foot is known.
- Max. Lateral Excursion
The maximal lateral distance between the foot and an imaginary straight line spanning from the start to the end position of each stride. This indicates “how far outwards” a subject moves the foot during the swing phase. Note, that this parameter is only meaningfull for straight strides. It is further assumed that the inward/outward rotation of the foot is small in comparison the the actual lateral swing of the leg.
[1] (1,2)Kanzler, C. M., Barth, J., Rampp, A., Schlarb, H., Rott, F., Klucken, J., Eskofier, B. M. (2015, August). Inertial sensor based and shoe size independent gait analysis including heel and toe clearance estimation. In 2015 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC) (pp. 5424-5427). IEEE.
[2]Rampp, A., Barth, J., Schülein, S., Gaßmann, K. G., Klucken, J., & Eskofier, B. M. (2014). Inertial sensor-based stride parameter calculation from gait sequences in geriatric patients. IEEE transactions on biomedical engineering, 62(4), 1089-1097.
Examples
This method requires the output of an event detection method and a full trajectory reconstruction (orientation and position) as input.
>>> stride_list = ... # from event detection >>> positions = ... # from position estimation >>> orientations = ... # from orientation estimation >>> spatial_paras = SpatialParameterCalculation() >>> spatial_paras = spatial_paras.calculate( ... stride_event_list=stride_list, positions=positions, orientations=orientations, sampling_rate_hz=204.8 ... ) >>> spatial_paras.parameters_ <Dataframe/dictionary with all the parameters> >>> spatial_paras.parameters_pretty_ <Dataframe/dictionary with all the parameters with units included in column names>
Methods
calculate(stride_event_list, positions, ...)Find spatial parameters of all strides after segmentation and detecting events for all sensors.
clone()Create a new instance of the class with all parameters copied over.
from_json(json_str)Import an gaitmap object from its json representation.
get_params([deep])Get parameters for this algorithm.
set_params(**params)Set the parameters of this Algorithm.
to_json()Export the current object parameters as json.
- __init__(calculate_only: Sequence[Literal['stride_length', 'gait_velocity', 'max_orientation_change', 'ic_angle', 'tc_angle', 'turning_angle', 'arc_length', 'max_sensor_lift', 'max_lateral_excursion']] | None = None, expected_stride_type: Literal['min_vel', 'ic'] = 'min_vel') None[source]#
- calculate(stride_event_list: DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame], positions: DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame] | None, orientations: DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame] | None, sampling_rate_hz: float) Self[source]#
Find spatial parameters of all strides after segmentation and detecting events for all sensors.
- Parameters:
- stride_event_list
Gait events for each stride obtained from event detection
- positions
Position of each sensor at each time point as estimated by trajectory reconstruction. Can be set to
Noneif you are only interested in orientation based features.- orientations
Orientation of each sensor at each time point as estimated by trajectory reconstruction Can be set to
Noneif you are only interested in position based features.- sampling_rate_hz
The sampling rate of the data signal.
- Returns:
- self
The class instance with spatial parameters populated in
self.parameters_,self.parameters_pretty_
- 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
- classmethod from_json(json_str: str) Self[source]#
Import an gaitmap object from its json representation.
For details have a look at the this example.
You can use the
to_jsonmethod of a class to export it as a compatible json string.- Parameters:
- json_str
json formatted string
- 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.