From 8630eafe0c4792093e1fc3342be6032f832b2e74 Mon Sep 17 00:00:00 2001 From: Annelinde Lettink Date: Tue, 25 Jun 2024 09:56:10 +0200 Subject: [PATCH 1/5] fix links to data and pucblication in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7151f85..a28a6be 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![codecov](https://codecov.io/gh/wadpac/mechanicalshakerexperiments/branch/main/graph/badge.svg?token=C2X6Z6AJLL)](https://codecov.io/gh/wadpac/mechanicalshakerexperiments) -The code in this repository corresponds to our research project to facilitate processing and analyzing data from a large pool of acceleration sensors that were attached to a mechanical shaker machine. The data itself is publicly available [here] ([https://pages.github.com/](https://zenodo.org/records/8160791)). +The code in this repository corresponds to our research project to facilitate processing and analyzing data from a large pool of acceleration sensors that were attached to a mechanical shaker machine. The data itself is publicly available here: https://zenodo.org/records/8160791. ### File reading @@ -28,7 +28,7 @@ The structured data per experiment can be loaded using the script subset_data.R ### Analyses -In our [recent publication](https://journals.humankinetics.com/view/journals/jmpb/7/1/article-jmpb.2024-0003.xml) we evaluate the comparability of raw acceleration data across sensor brands and configurations we performed frequency spectrum analysis and temporal correlation analysis. The scripts used for the data analyses performed of this article include ‘analyses’ in their name. +In our recent publication (https://journals.humankinetics.com/view/journals/jmpb/7/1/article-jmpb.2024-0003.xml) we evaluate the comparability of raw acceleration data across sensor brands and configurations we performed frequency spectrum analysis and temporal correlation analysis. The scripts used for the data analyses performed of this article include ‘analyses’ in their name. ### References From c4980d0de6187f56bc9e2e42d5aa82b2617af3d2 Mon Sep 17 00:00:00 2001 From: Annelinde Lettink Date: Tue, 25 Jun 2024 10:04:33 +0200 Subject: [PATCH 2/5] fix cmd check g.downsample package --- R/autocalibration.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/autocalibration.R b/R/autocalibration.R index 702b115..627005a 100644 --- a/R/autocalibration.R +++ b/R/autocalibration.R @@ -8,7 +8,7 @@ #' @param brand Character of sensor brand: "ActiGraph", "activPAL", "Acttrust", "Axivity", "GENEActiv", or "MOX". #' @return List of objects identical to g.calibrate function R package GGIR #' @importFrom stats sd lm.wfit -#' @importFrom GGIR g.downsample +#' @importFrom GENEAread g.downsample #' @export autocalibration = function(data, sr, printsummary= TRUE, brand) { From fd064213b10aacd0cefae4bcad19a72be5c8d728 Mon Sep 17 00:00:00 2001 From: Annelinde Lettink Date: Tue, 25 Jun 2024 10:04:33 +0200 Subject: [PATCH 3/5] fix cmd check g.downsample package dependency --- NAMESPACE | 2 +- R/autocalibration.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index d32934d..940fa92 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,8 +20,8 @@ export(structure_data) import(foreach) import(ggplot2) import(ggpubr) +importFrom(GENEAread,g.downsample) importFrom(GENEAread,read.bin) -importFrom(GGIR,g.downsample) importFrom(GGIRread,readAxivity) importFrom(GGIRread,resample) importFrom(data.table,fread) diff --git a/R/autocalibration.R b/R/autocalibration.R index 702b115..627005a 100644 --- a/R/autocalibration.R +++ b/R/autocalibration.R @@ -8,7 +8,7 @@ #' @param brand Character of sensor brand: "ActiGraph", "activPAL", "Acttrust", "Axivity", "GENEActiv", or "MOX". #' @return List of objects identical to g.calibrate function R package GGIR #' @importFrom stats sd lm.wfit -#' @importFrom GGIR g.downsample +#' @importFrom GENEAread g.downsample #' @export autocalibration = function(data, sr, printsummary= TRUE, brand) { From d0693e3dbd375d45f2f457bd5aa67a8ddae56876 Mon Sep 17 00:00:00 2001 From: Annelinde Lettink Date: Tue, 25 Jun 2024 10:28:39 +0200 Subject: [PATCH 4/5] quick fix removed downsampling function from GGIR --- R/autocalibration.R | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/R/autocalibration.R b/R/autocalibration.R index 627005a..e2f5af8 100644 --- a/R/autocalibration.R +++ b/R/autocalibration.R @@ -8,12 +8,12 @@ #' @param brand Character of sensor brand: "ActiGraph", "activPAL", "Acttrust", "Axivity", "GENEActiv", or "MOX". #' @return List of objects identical to g.calibrate function R package GGIR #' @importFrom stats sd lm.wfit -#' @importFrom GENEAread g.downsample #' @export autocalibration = function(data, sr, printsummary= TRUE, brand) { # simplified version of auto-calibration from R package GGIR # without temperature and without loading the data in blocks + # now includes old g.downsampling function removed from GGIR... spherecrit=0.3 minloadcrit=72 @@ -73,13 +73,31 @@ autocalibration = function(data, sr, printsummary= TRUE, brand) { #============================================= # non-integer sampling rate is a pain for deriving epoch based sd # however, with an epoch of 10 seconds it is an integer number of samples per epoch + g.downsample = function(sig,fs,ws3,ws2) { + #averaging per second => var1 + sig2 =cumsum(c(0,sig)) + select = seq(1,length(sig2),by=fs) + var1 = diff(sig2[round(select)]) / abs(diff(round(select[1:(length(select))]))) + #averaging per ws3 => var2 (e.g. 5 seconds) + select = seq(1,length(sig2),by=fs*ws3) + var2 = diff(sig2[round(select)]) / abs(diff(round(select[1:(length(select))]))) + #averaging per ws2 => var3 (e.g. 15 minutes) + select = seq(1,length(sig2),by=fs*ws2) + var3 = diff(sig2[round(select)]) / abs(diff(round(select[1:(length(select))]))) + invisible(list(var1=var1,var2=var2,var3=var3)) + } + EN = sqrt(Gx^2 + Gy^2 + Gz^2) - D1 = GGIR::g.downsample(EN,sr,ws4,ws2) + D1 = g.downsample(EN,sr,ws4,ws2) EN2 = D1$var2 #mean acceleration - D1 = GGIR::g.downsample(Gx,sr,ws4,ws2); GxM2 = D1$var2 - D1 = GGIR::g.downsample(Gy,sr,ws4,ws2); GyM2 = D1$var2 - D1 = GGIR::g.downsample(Gz,sr,ws4,ws2); GzM2 = D1$var2 + + D1 = g.downsample(Gx,sr,ws4,ws2); GxM2 = D1$var2 + D1 = g.downsample(Gy,sr,ws4,ws2); GyM2 = D1$var2 + D1 = g.downsample(Gz,sr,ws4,ws2); GzM2 = D1$var2 + + + #sd acceleration dim(Gx) = c(sr*ws4,ceiling(length(Gx)/(sr*ws4))); GxSD2 = apply(Gx,2,sd) dim(Gy) = c(sr*ws4,ceiling(length(Gy)/(sr*ws4))); GySD2 = apply(Gy,2,sd) From 7b3e73de6ae481df04717623b4ab2ee2af9e214f Mon Sep 17 00:00:00 2001 From: Annelinde Lettink Date: Tue, 25 Jun 2024 10:33:03 +0200 Subject: [PATCH 5/5] improve linking to data and article --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a28a6be..0151e87 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![codecov](https://codecov.io/gh/wadpac/mechanicalshakerexperiments/branch/main/graph/badge.svg?token=C2X6Z6AJLL)](https://codecov.io/gh/wadpac/mechanicalshakerexperiments) -The code in this repository corresponds to our research project to facilitate processing and analyzing data from a large pool of acceleration sensors that were attached to a mechanical shaker machine. The data itself is publicly available here: https://zenodo.org/records/8160791. +The code in this repository corresponds to our research project to facilitate processing and analyzing data from a large pool of acceleration sensors that were attached to a mechanical shaker machine. The data itself is publicly available [here](https://zenodo.org/records/8160791). ### File reading @@ -28,7 +28,7 @@ The structured data per experiment can be loaded using the script subset_data.R ### Analyses -In our recent publication (https://journals.humankinetics.com/view/journals/jmpb/7/1/article-jmpb.2024-0003.xml) we evaluate the comparability of raw acceleration data across sensor brands and configurations we performed frequency spectrum analysis and temporal correlation analysis. The scripts used for the data analyses performed of this article include ‘analyses’ in their name. +In our [recent publication](https://journals.humankinetics.com/view/journals/jmpb/7/1/article-jmpb.2024-0003.xml) we evaluate the comparability of raw acceleration data across sensor brands and configurations we performed frequency spectrum analysis and temporal correlation analysis. The scripts used for the data analyses performed of this article include ‘analyses’ in their name. ### References