Skip to content

Commit 5aa4412

Browse files
authored
Merge pull request #50 from PhysicalActivityOpenTools/issue49_minorBugCalibration
Issue49 minor bug calibration
2 parents 2bfa418 + 087faef commit 5aa4412

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: actimetric
22
Type: Package
33
Title: Classifies Accelerometer Data Into Physical Activity Types
4-
Version: 0.1.2
4+
Version: 0.1.3
55
Authors@R: c(person("Jairo H","Migueles", role = c("aut","cre"),
66
email = "[email protected]",
77
comment = c(ORCID = "0000-0003-0366-6935")),
@@ -20,7 +20,7 @@ LazyData: true
2020
Suggests:
2121
testthat (>= 3.0.0), randomForest, gsignal, rattle
2222
Config/testthat/edition: 3
23-
RoxygenNote: 7.2.3
23+
RoxygenNote: 7.3.1
2424
Depends:
2525
R (>= 2.10)
2626
Imports:

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# actimetric 0.1.3
2+
3+
* Calibration: fix minor bug by which calibration procedure was using time column instead of acceleration columns in data #49
4+
15
# actimetric 0.1.2
26

37
* Documentation: include references to papers, other pieces of code, packages, and authorships #41

R/ReadAndCalibrate.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ ReadAndCalibrate = function(file, sf, blocksize, blocknumber, inspectfileobject,
8787
# MODULE 3 - EXTRACT CALIBRATION COEFFICIENTS -----------------------------
8888
calCoefs = vm.error.st = vm.error.end = NULL
8989
if (do.calibration == TRUE & iteration == 1) {
90-
cal = calibrateRaw(data, sf = sf, verbose = verbose)
90+
accCols = which(colnames(data) %in% c("x","y","z"))
91+
cal = calibrateRaw(data[, accCols], sf = sf, verbose = verbose)
9192
if (is.list(cal)) {
9293
calCoefs = cal$calCoefs; vm.error.st = cal$vm.error.st;
9394
vm.error.end = cal$vm.error.end

R/featuresTrost2017.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ featuresTrost2017 = function(data, epoch, sf) {
4343
k[i, column + 4] = mean(A, trim = 0.05, na.rm = TRUE)
4444
k[i, column + 5] = sd(A, na.rm = TRUE)
4545
k[i, column + 6] = sum((A*A), na.rm = TRUE)
46-
k[i, column + 7] = cor(Axis[from:(to - 1)], Axis[(from + 1):to], use = "pairwise.complete.obs")
46+
if (sd(A, na.rm = TRUE) != 0) { #this avoids warning when no variability (e.g., idle sleep mode in actigraph)
47+
k[i, column + 7] = cor(Axis[from:(to - 1)], Axis[(from + 1):to], use = "pairwise.complete.obs")
48+
} else {
49+
k[i, column + 7] = NA
50+
}
4751
k[i, column + 8] = median(A, na.rm = TRUE)
4852
k[i, column + 9] = mad(abs(A), na.rm = TRUE)
4953
k[i, column + 10] = as.vector(quantile(A, c(.10), na.rm = TRUE))

0 commit comments

Comments
 (0)