Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension to PR 993 #995

Merged
merged 13 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- Part 5: Fix bug in recently added functionality for studying overlap between sibs and self-reported behaviours #989.

- Part 1: Fix bug in adhoc-csv format calibration process as it could not extract temperature column #991
- Part 1:Enable use of temperature data in adhoc-csv format throughout GGIR #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.

Expand Down
2 changes: 1 addition & 1 deletion R/convertEpochData.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
}
if (is.na(vmcol[1]) == FALSE) {
D = as.matrix(D, drop = FALSE) # convert to matrix as data.frame will auto-collapse to vector
colnames(D)[vmcol] = c("NeishabouriCount_vm")
colnames(D)[vmcol] = c("NeishabouriCount_x")

Check warning on line 261 in R/convertEpochData.R

View check run for this annotation

Codecov / codecov/patch

R/convertEpochData.R#L261

Added line #L261 was not covered by tests
}
keep = c(acccol, vmcol)[!is.na(c(acccol, vmcol))]
D = D[, keep, drop = FALSE]
Expand Down
23 changes: 8 additions & 15 deletions R/g.getmeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@
QClog = NULL
if (temp.available == FALSE) {
metalong = matrix(" ", ((nev/(sf*ws2)) + 100), 4) #generating output matrix for 15 minutes summaries
} else if (temp.available == TRUE && mon != MONITOR$MOVISENS) {
} else if (temp.available == TRUE && mon != MONITOR$MOVISENS && mon != MONITOR$AD_HOC) {
metalong = matrix(" ", ((nev/(sf*ws2)) + 100), 7) #generating output matrix for 15 minutes summaries
} else if (temp.available == TRUE && mon == MONITOR$MOVISENS) {
} else if (temp.available == TRUE && (mon == MONITOR$MOVISENS || mon == MONITOR$AD_HOC)) {

Check warning on line 207 in R/g.getmeta.R

View check run for this annotation

Codecov / codecov/patch

R/g.getmeta.R#L207

Added line #L207 was not covered by tests
metalong = matrix(" ", ((nev/(sf*ws2)) + 100), 5) #generating output matrix for 15 minutes summaries
}
#===============================================
Expand Down Expand Up @@ -364,10 +364,10 @@
(mon == MONITOR$AXIVITY && dformat == FORMAT$CSV) ||
(mon == MONITOR$AD_HOC && use.temp == FALSE)) {
metricnames_long = c("timestamp","nonwearscore","clippingscore","en")
} else if (mon == MONITOR$GENEACTIV || (mon == MONITOR$AXIVITY && dformat == FORMAT$CWA) ||
(mon == MONITOR$AD_HOC & use.temp == TRUE)) {
} else if (mon == MONITOR$GENEACTIV || (mon == MONITOR$AXIVITY && dformat == FORMAT$CWA)) {

Check warning on line 367 in R/g.getmeta.R

View check run for this annotation

Codecov / codecov/patch

R/g.getmeta.R#L367

Added line #L367 was not covered by tests
metricnames_long = c("timestamp","nonwearscore","clippingscore","lightmean","lightpeak","temperaturemean","EN")
} else if (mon == MONITOR$MOVISENS) {
} else if (mon == MONITOR$MOVISENS || (mon == MONITOR$AD_HOC & use.temp == TRUE)) {

Check warning on line 369 in R/g.getmeta.R

View check run for this annotation

Codecov / codecov/patch

R/g.getmeta.R#L369

Added line #L369 was not covered by tests
# at the moment read.myacc.csv does not facilitate extracting light data, so only temperature is used
metricnames_long = c("timestamp","nonwearscore","clippingscore","temperaturemean","EN")
}
rm(SWMT)
Expand Down Expand Up @@ -424,7 +424,7 @@
} else if (mon == MONITOR$MOVISENS) {
temperaturecolumn = 4
} else if (mon == MONITOR$AD_HOC) {
temperaturecolumn = params_rawdata[["rmc.col.temp"]]
temperaturecolumn = which(colnames(data) == "temperature")

Check warning on line 427 in R/g.getmeta.R

View check run for this annotation

Codecov / codecov/patch

R/g.getmeta.R#L427

Added line #L427 was not covered by tests
}
if (mon != MONITOR$AD_HOC && mon != MONITOR$MOVISENS) {
light = as.numeric(data[, lightcolumn])
Expand All @@ -435,7 +435,6 @@
}
temperature = as.numeric(data[, temperaturecolumn])
}

# Initialization of variables
data_scaled = FALSE
if (mon == MONITOR$ACTIGRAPH && dformat == FORMAT$GT3X) {
Expand Down Expand Up @@ -485,12 +484,6 @@
data = apply(data, 2,as.numeric)
}
}
if (ncol(data) >= 4 & mon == MONITOR$AD_HOC) {
columns_to_use = params_rawdata[["rmc.col.acc"]]
} else {
columns_to_use = 1:3
}
data = data[,columns_to_use]
suppressWarnings(storage.mode(data) <- "numeric")
if ((mon == MONITOR$ACTIGRAPH || mon == MONITOR$AD_HOC || mon == MONITOR$VERISENSE) && use.temp == FALSE) {
data = scale(data,center = -offset, scale = 1/scale) #rescale data
Expand Down Expand Up @@ -610,7 +603,7 @@
metalong[count2:((count2 - 1) + length(NWav)),col_mli] = NWav; col_mli = col_mli + 1
metalong[(count2):((count2 - 1) + length(NWav)),col_mli] = CWav; col_mli = col_mli + 1
if (mon == MONITOR$GENEACTIV || (mon == MONITOR$AXIVITY && dformat == FORMAT$CWA) ||
mon == MONITOR$MOVISENS) { # going from sample to ws2
mon == MONITOR$MOVISENS || (mon == MONITOR$AD_HOC && length(params_rawdata[["rmc.col.temp"]]) != 0)) { # going from sample to ws2
if (mon == MONITOR$GENEACTIV || mon == MONITOR$AXIVITY) {
#light (running mean)
lightc = cumsum(c(0,light))
Expand Down Expand Up @@ -646,7 +639,7 @@
col_mli = col_mli + 1
metalong[(count2):((count2 - 1) + length(NWav)), col_mli] = round(temperatureb, digits = n_decimal_places)
col_mli = col_mli + 1
} else if (mon == MONITOR$MOVISENS) {
} else if (mon == MONITOR$MOVISENS || (mon == MONITOR$AD_HOC && length(params_rawdata[["rmc.col.temp"]]) != 0)) {
metalong[(count2):((count2 - 1) + length(NWav)), col_mli] = round(temperatureb, digits = n_decimal_places)
col_mli = col_mli + 1
}
Expand Down