Inertial measurement unit (IMU)
Inertial measurement units (IMUs) are electronic devices that measure and report a body's specific force (acceleration and angular velocity) and orientation (roll, pitch, and yaw). IMU signals are often used to measure activity, posture, and gait. In PhysioKit, we provide a variety of routines for processing IMU signals.
physiokit.imu.clean
clean(data, lowcut=3, highcut=11, sample_rate=1000, order=3, axis=-1)
Clean accelerometer signal using biquad filter.
By default applies a 3rd order Butterworth filter between 0.5 and 4 Hz.
Parameters:
-
data
(NDArray
) –Accelerometer signal
-
lowcut
(float
, default:3
) –Lower cutoff in Hz. Defaults to 3 Hz.
-
highcut
(float
, default:11
) –Upper cutoff in Hz. Defaults to 11 Hz.
-
sample_rate
(float
, default:1000
) –Sample rate in Hz. Defaults to 1000 Hz.
-
order
(int
, default:3
) –Filter order. Defaults to 3 (3rd order Butterworth filter).
-
axis
(int
, default:-1
) –Axis to apply against. Defaults to -1.
Returns:
-
NDArray
–npt.NDArray: Cleaned signal
Source code in physiokit/imu/clean.py
physiokit.imu.metrics
compute_counts(data, sample_rate=1000, epoch_len=10, min_thresh=4, max_thresh=128)
Compute counts from raw accelerometer data.
Reference: https://doi.org/10.1038/s41598-022-16003-x
Parameters:
-
data
(NDArray
) –2-D raw accelerometer data [ts x axis] in G.
-
sample_rate
(float
, default:1000
) –Sampling rate in Hz. Defaults to 1000 Hz.
-
epoch_len
(int
, default:10
) –Epoch length in seconds. Defaults to 10.
-
min_thresh
(int
, default:4
) –Minimum threshold. Defaults to 4.
-
max_thresh
(int
, default:128
) –Maximum threshold. Defaults to 128.
Returns:
-
NDArray
–npt.NDArray: 2-D counts data [ts x axis] in counts.
Source code in physiokit/imu/metrics.py
compute_enmo(x, y, z)
Compute ENMO from x, y, and z accelerometer data.
Reference: https://doi.org/10.1371/journal.pone.0142533
Parameters:
-
x
(NDArray
) –x-axis accelerometer data
-
y
(NDArray
) –y-axis accelerometer data
-
z
(NDArray
) –z-axis accelerometer data
Returns:
-
NDArray
–npt.NDArray: ENMO data
Source code in physiokit/imu/metrics.py
compute_tilt_angles(x, y, z, in_radians=True)
Compute tilt angles from x, y, and z accelerometer data.
Reference: https://doi.org/10.1371/journal.pone.0142533
Parameters:
-
x
(NDArray
) –x-axis accelerometer data
-
y
(NDArray
) –y-axis accelerometer data
-
z
(NDArray
) –z-axis accelerometer data
-
in_radians
(bool
, default:True
) –If True, return angles in radians. Defaults to True.
Returns:
-
tuple[NDArray, NDArray, NDArray]
–tuple[npt.NDArray, npt.NDArray, npt.NDArray]: Tilt angles in radians or degrees