Counts steps by peak-detecting the dynamic acceleration magnitude (vector
magnitude minus gravity). Peaks must exceed a prominence threshold and be
separated by at least the shortest plausible step interval
(1 / max_step_hz), which suppresses double counts.
Usage
detectSteps(
accel,
sampling_rate,
min_step_hz = 0.5,
max_step_hz = 4,
threshold = NULL,
min_amplitude = 0.05
)Arguments
- accel
An n x 3 matrix of acceleration in g units, or a numeric vector already representing an acceleration magnitude.
- sampling_rate
Sampling rate in Hz.
- min_step_hz, max_step_hz
Plausible step-frequency range in Hz (defaults 0.5 and 4).
- threshold
Minimum peak height in the dynamic magnitude (g).
NULLusesmax(0.5 * sd(dynamic magnitude), min_amplitude); the absolute floor stops sensor noise in a still recording from being counted as steps.- min_amplitude
Absolute floor (g) for the automatic threshold (default 0.05).
Value
A wearable_steps list with n_steps, step_index (sample indices
of detected steps), and cadence_spm (steps per minute).