You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using segmentWalking, if you are using a sampling frequency < 15, you will get an error. This is because the hard-coded parameter x.adept.ma.W is 0.2:
if (W.vl<3) stop("W.vl (refer to function's details description) must not be smaller than 3 vector indices. Define wider W averaging window length")
Proposed Solutions
Either we don't hard code the parameters in segmentWalking (i.e. pass them through as arguments, with defaults as they are in the code now): downsides are that it may be different than the proposed "ADEPT" algorithm. Also, likely unclear to many users as to what x.adept.ma.W should be.
Note in the documentation that if you have Hz < 13, then this will fail and to run segmentPattern separately
Adapt x.adept.ma.W to the sample rate
Adapt x.adept.ma.W for low frequency samples.
Issue: Reproducible Example
We took the example from adept::segmentWalking and show that this does indeed fail:
library(adeptdata)
library(dplyr)
#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, union
library(adept)
xyz<-adeptdata::acc_walking_IU %>%
filter(loc_id=="left_wrist", subj_id=="id86237981") %>%
arrange(time_s) %>%
select(v1=x, v2=y, v3=z) %>%
as.matrix()
# define raw accelerometry data sample frequencyxyz.fs<-10# define template list based on predefined templatestemplate_mat<-adeptdata::stride_template$left_wrist[[3]]
template<-list(
template_mat[1, ],
template_mat[2, ],
template_mat[3, ]
)
# run walking segmentation# (parallel supported, except for Windows; see run.parallel, run.parallel.cores args)
segmentWalking(xyz, xyz.fs, template)
#> Error in windowSmooth(x = x, W = W, x.fs = x.fs): W.vl (refer to function's details description) must not be smaller than 3 vector indices. Define wider W averaging window length
Issue
When using
segmentWalking
, if you are using a sampling frequency < 15, you will get an error. This is because the hard-coded parameterx.adept.ma.W
is0.2
:adept/R/segmentWalking.R
Line 171 in d7165ad
and
segmentPattern
callsget.x.smoothed
:adept/R/segmentPattern.R
Line 276 in d7165ad
which then calls
windowSmooth
:adept/R/windowSmooth.R
Line 134 in d7165ad
where
W = 0.2
andx.fs = 10
(or anyx.fs
< 12.5) will fail sinceW.vl <- round(W * x.fs)
will be less than 3 and fail:adept/R/windowSmooth.R
Lines 56 to 57 in d7165ad
Proposed Solutions
segmentWalking
(i.e. pass them through as arguments, with defaults as they are in the code now): downsides are that it may be different than the proposed "ADEPT" algorithm. Also, likely unclear to many users as to whatx.adept.ma.W
should be.segmentPattern
separatelyx.adept.ma.W
to the sample ratex.adept.ma.W
for low frequency samples.Issue: Reproducible Example
We took the example from
adept::segmentWalking
and show that this does indeed fail:Created on 2023-10-18 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: