Skip to content

Commit

Permalink
Merge branch 'master' into issue991_v2_tempcolumn_adhoccsv_calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Dec 13, 2023
2 parents 574131c + 4a1ee62 commit 83fe8dd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

- Part 1: Fix bug in adhoc-csv format calibration process as it could not extract temperature column #991

- Part 1: Fix bug that caused a mismatch between IDs and filenames in part 1 when movisens participant folders did not contain the acc.bin file #994.

# CHANGES IN GGIR VERSION 3.0-1

- Part 2: Added option to provide a csv file with start and end dates when accelerometer is expected to be worn #943
Expand Down
20 changes: 18 additions & 2 deletions R/datadir2fnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,24 @@ datadir2fnames = function(datadir,filelist) {
fnamesfull = fnamesRD
}
} else {
fnamesfull = datadir
fnames = basename(fnamesfull)
if (ismovisens(datadir)) {
fnamesfull = dir(datadir, recursive = TRUE, pattern = "acc.bin", full.names = TRUE)
fnames = basename(dirname(fnamesfull))
nfolders = length(dir(datadir))
if (nfolders > length(fnamesfull)) { # meaning there are movisens data folder without acc.bin
# folders without acc.bin
allfolders = dir(datadir, full.names = TRUE)
foldersWithAccBin = dirname(fnamesfull)
noAccBin = allfolders[which(!allfolders %in% foldersWithAccBin)]
warning(paste0("The following movisens data folders do not contain the ",
"acc.bin file with the accelerometer recording, and ",
"therefore cannot be processed in GGIR: ",
paste(noAccBin, collapse = ", ")), call. = FALSE)
}
} else {
fnamesfull = datadir
fnames = basename(fnamesfull)
}
}
invisible(list(fnames = fnames, fnamesfull = fnamesfull))
}
7 changes: 1 addition & 6 deletions R/g.part1.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ g.part1 = function(datadir = c(), metadatadir = c(), f0 = 1, f1 = c(), myfun = c

if (f1 == 0) warning("\nWarning: f1 = 0 is not a meaningful value")
filelist = isfilelist(datadir)
if (ismovisens(datadir)) filelist = TRUE

# list all accelerometer files
dir2fn = datadir2fnames(datadir, filelist)
fnames = dir2fn$fnames
fnamesfull = dir2fn$fnamesfull

# check whether these are movisens files
if (filelist == FALSE & ismovisens(datadir) == TRUE) {
fnamesfull = dir(datadir, recursive = TRUE, pattern = "acc.bin", full.names = TRUE)
fnames = dir(datadir, recursive = FALSE)
}
filesizes = file.size(fnamesfull) # in bytes
bigEnough = which(filesizes/1e6 > params_rawdata[["minimumFileSizeMB"]])
fnamesfull = fnamesfull[bigEnough]
Expand Down
5 changes: 3 additions & 2 deletions vignettes/GGIR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ additional packages:
the absence of timestamps GGIR will calculate timestamps from
the sample frequency, the start time and start date as presented
in the file header.
- [Movisens](https://www.movisens.com/en/) with data stored in
folders.
- [Movisens](https://www.movisens.com/en/) .bin files with data
stored in folders. GGIR expects that each participant's folder
contains at least a file named acc.bin.
- Any other accelerometer brand that generates csv output, see
documentation for functions `read.myacc.csv` and argument
`rmc.noise` in the [GGIR function documentation
Expand Down

0 comments on commit 83fe8dd

Please sign in to comment.