IMU

Functions for processing inertial measurement unit (IMU) data, including orientation kinematics, tilt estimation, and step detection.

Kinematics

biomechzoo.imu.tilt_algorithm.tilt_algorithm_data(data, ch_vert, ch_medlat, ch_antpost, plot_or_not=None)[source]
biomechzoo.imu.tilt_algorithm.tilt_algorithm_line(avert, amedlat, aantpost)[source]

TiltAlgorithm - to account for gravity and improper tilt alignment of a tri-axial trunk accelerometer.

Step 1: Extract raw measured (mean) accelerations Step 2: Calculate tilt angles Step 3: Calculate horizontal dynamic accelerations vectors Step 4: Calculate estimated provisional vertical vector Step 5: Calculate vertical dynamic vector step 6.1: Calculate the contribution of static components step 6.2 Transpose static component matrices step 7: Remove the static components from the templates of pre and post

Parameters:
  • avert (1D-array) – data predominantly in vertical direction. Expressed in g’s

  • amedlat (1D-array:) – data predominantly in medio-lateral direction. Expressed in g’s

  • aantpost (1D-array) – data predominantly in anterior-posterior direction. Expressed in g’s

Returns:

  • df_corrected (Nx3 DataFrame) – the tilt corrected and gravity subtracted vertical, medio-lateral and anterior-posterior acceleration signals

  • avert2 (1D-array) – the tilt corrected acceleration data in vertical direction

  • amedlat2 (1D-array) – the tilt corrected acceleration data in medio-lateral direction

  • aantpost2 (1D-array) – the tilt corrected acceleration data in anterior-posterior direction

Notes

  • If average acceleration is above 5m/s^2, the signal will be corrected.

Step Detection

biomechzoo.imu.step_detection.imu_mcgrath(ch_line, fsamp, min_stance_t, is_filtered=False)[source]

This function detects the steps based on the method of McGrath et al. (2012) https://doi.org/10.1007/s12283-012-0093-8 in short, the first minimum after a local maximum is the heel strike. The local maxima are the mid-swing. Data should be filtered

biomechzoo.imu.step_detection.crash_catch(min_stance_samples, IC, TC)[source]