View source: R/verisense_count_steps.R
| verisense_count_steps | R Documentation |
This method is based off finding peaks in the summed and squared acceleration signal and then using multiple thresholds to determine if each peak is a step or an artifact. An additional magnitude threshold was added to the algorithm to prevent false positives in free living data.
verisense_count_steps(
data,
sample_rate,
k = 3,
periodicity_range = c(5, 15),
similarity_threshold = -0.5,
continuity_window_size = 4,
continuity_threshold = 4,
variance_threshold = 0.001,
vm_threshold = 1.2,
peak_finder = c("fast", "original"),
verbose = TRUE,
global_vm_threshold = 0.025
)
verisense_count_steps_revised(
...,
k = 4,
periodicity_range = c(4, 20),
similarity_threshold = -1,
continuity_window_size = 4,
continuity_threshold = 4,
variance_threshold = 0.01,
vm_threshold = 1.25
)
data |
A |
sample_rate |
sampling frequency of the input data |
k |
window size for controlling peak finding. |
periodicity_range |
a length-2 vector of the range of periodicity. These are integers that represent samples not seconds. |
similarity_threshold |
threshold (in g) for similarity between magnitude of peaks |
continuity_window_size |
Window size for continuity |
continuity_threshold |
Threshold for continuity |
variance_threshold |
Variance threshold for the signal |
vm_threshold |
vector magnitude threshold for a peak to be called a peak |
peak_finder |
function to find peaks, either the "original" from the code, or the optimized "fast" version. |
verbose |
print diagnostic messages |
global_vm_threshold |
Global acceleration VM threshold (in standard
deviation) for the total vector. If |
... |
not used, used to passes arguments from
|
A vector of length round(nrow(input_data) / sample_rate) of the
estimated steps, where the data is rounded to seconds
the _revised version is the same algorithm with different defaults
for the parameters as based on doi:10.3390/s22249984.
Matthew R Patterson mpatterson@shimmersensing.com, MIT license, Copyright (c) 2020 Shimmer
csv_file = system.file("test_data_bout.csv", package = "walking")
if (requireNamespace("readr", quietly = TRUE)) {
x = readr::read_csv(csv_file)
colnames(x)[colnames(x) == "UTC time"] = "time"
out = verisense_count_steps(x, sample_rate = 10L)
}
input_data <- matrix(runif(500 * 3, min = -1.5, max = 1.5), ncol = 3)
verisense_count_steps(input_data, sample_rate = 15L)
verisense_count_steps(input_data, sample_rate = 15L, peak_finder = "fast")
acc = sqrt(rowSums(input_data^2))
verisense_count_steps(acc, sample_rate = 15L, peak_finder = "fast")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.