Skip to content

Commit

Permalink
improve code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Nov 22, 2024
1 parent 6310360 commit efa32cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/g.part2.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ g.part2 = function(datadir = c(), metadatadir = c(), f0 = c(), f1 = c(),
params_output = params$params_output
params_general = params$params_general
#-----------------------------
use_qwindow_as_diary = TRUE # If there is a diary specified via qwindow use it
use_qwindow_as_diary = TRUE # If there is a diary specified via qwindow use it as qwindow
if (is.numeric(params_247[["qwindow"]])) {
params_247[["qwindow"]] = params_247[["qwindow"]][order(params_247[["qwindow"]])]
} else if (is.character(params_247[["qwindow"]])) {
if (length(grep(pattern = "onlyfilter", x = params_247[["qwindow"]])) > 0) {
use_qwindow_as_diary = FALSE # Do not use it if it has the word onlyfilter
# Do not use diary specified for qwindow if it has the word
# "onlyfilter", but use it for filterning nighttime nonwear
# note that this filtering is only use if parameter nonwearFiltermaxHours is specified.
use_qwindow_as_diary = FALSE
}
params_247[["qwindow"]] = g.conv.actlog(params_247[["qwindow"]],
params_247[["qwindow_dateformat"]],
Expand Down Expand Up @@ -156,7 +159,8 @@ g.part2 = function(datadir = c(), metadatadir = c(), f0 = c(), f1 = c(),
}
qwindowImp = params_247[["qwindow"]]
if (use_qwindow_as_diary == FALSE) {
# reset qwindow to default
# reset qwindow to default, because it is only used
# for filtering short nighttime nonwear
params_247[["qwindow"]] = c(0, 24)
}
if (inherits(qwindowImp, "data.frame")) {
Expand Down
3 changes: 3 additions & 0 deletions R/g.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ g.part5 = function(datadir = c(), metadatadir = c(), f0=c(), f1=c(),
epochSize = ws3new)
# This will be an object with numeric qwindow values for all individuals and days
} else {
# ignore the diary specified by qwindow because user only want to use
# it for filtering night time nonwear in part 2, but not as a way to
# do day segment analysis.
params_247[["qwindow"]] = c(0, 24)
}
}
Expand Down

0 comments on commit efa32cf

Please sign in to comment.