src.event_detection package

src.event_detection.imu_event_detection module

src.event_detection.imu_event_detection.gyro_threshold_stance(imu, stance_magnitude_threshold=0.5, stance_count_threshold=8)

As presented by Tunca et al. (https://doi.org/10.3390/s17040825). Detect stance phases according to the given gyroscope magnitude, and minimum sample length threshold value.

Parameters
  • imu (IMU) – IMU object with data

  • stance_magnitude_threshold (float) – magnitude threshold

  • stance_count_threshold (int) – grace period in samples

Returns

Boolean vector indicating stance phases

Return type

np.array

src.event_detection.imu_event_detection.hundza_gait_events(imu)

Gait event detection by Hundza et al. (https://doi.org/10.1109/TNSRE.2013.2282080) An example of another gait event detection algorithm.

Parameters

imu (IMU) – IMU object with data

Returns

timesteps of different gait events TOFS, IOFS, TO (see Hundza paper) and stance vector

Return type

tuple[list[float], ..]

src.event_detection.imu_event_detection.tunca_gait_events(imu, stance_magnitude_threshold, stance_count_threshold)

Gait event detection by Tunca et al. (https://doi.org/10.3390/s17040825)

Parameters
  • imu (IMU) – IMU object with data

  • gyro_threshold (float) – gyroscope threshold for identifying stance phases

  • stance_count_threshold (int) – stance count threshold for identifying stance phases

Returns

index of IC_samples, FO_samples, timestamps of IC_times, FO_times and stance indicator

Return type

tuple[list[float], ..]

src.event_detection.imu_event_detection.zero_crossing(x_1, x_2, y_1, y_2)

Helper function: linear interpolation for zero crossing between points (x_1, y_1) and (x_2, y_2).

Parameters
  • x_1 (float) – x coordinate point 1

  • x_2 (float) – x coordinate point 2

  • y_1 (float) – y coordinate point 1

  • y_2 (float) – y coordinate point 2

Returns

x value for zero-crossing point

Return type

float