diff --git a/DESCRIPTION b/DESCRIPTION index cda66dc..965c619 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: GGIRread Type: Package Title: Wearable Accelerometer Data File Readers -Version: 1.0.10 -Date: 2026-08-26 +Version: 1.0.11 +Date: 2026-09-07 Authors@R: c(person("Vincent T","van Hees",role=c("aut","cre"), email="v.vanhees@accelting.com"), person(given = "Patrick",family = "Bos", @@ -15,6 +15,7 @@ Authors@R: c(person("Vincent T","van Hees",role=c("aut","cre"), person("Dan","Jackson",role="ctb"), person("Jairo H","Migueles",role="ctb"), person("John","Muschelli",role="ctb"), + person("Jia Ying","Chua",role="ctb"), person("Medical Research Council UK", role = c("cph", "fnd")), person("Accelting", role = c("cph", "fnd"))) Maintainer: Vincent T van Hees diff --git a/NEWS.md b/NEWS.md index 048e9a4..e80cdbe 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# Changes in version 1.0.11 (release date:07-09-2026) + +- Added GENEActiv light calibration needed for device model GENEActiv 1.2 and above. Contributed by ActivInsights Ltd, the manufacturer of GENEActiv devices. + # Changes in version 1.0.10 (release date:26-08-2026) - Fix bug in readGENEActiv with `path.expand`. #94 @muschellij2 diff --git a/R/readGENEActiv.R b/R/readGENEActiv.R index 183f77a..1b81e92 100644 --- a/R/readGENEActiv.R +++ b/R/readGENEActiv.R @@ -80,12 +80,33 @@ readGENEActiv = function(filename, start = 0, end = 0, progress_bar = FALSE, } starttime_num = as.numeric(starttime_posix) + page_offset rawdata$time = rawdata$time + abs(rawdata$time[1]) + starttime_num + + # Apply device-specific light calibration + light <- rawdata$lux + + if (grepl("1\\.1$", DeviceModel)) { + light <- light * (Lux / Volts) + } else { + light <- ifelse(light < 256, light, + ifelse(light < 512, (light - 128) * 2, + ifelse(light < 768, (light - 320) * 4, + ifelse(light < 1024, (light - 656) * 16, + 5888 + ) + ) + ) + ) + light <- light * (Lux / Volts) + } + return(invisible(list( header = header, - data.out = data.frame(time = rawdata$time, - x = rawdata$x, y = rawdata$y, z = rawdata$z, - light = rawdata$lux * (Lux/Volts), - temperature = rawdata$temperature, - stringsAsFactors = TRUE) + data.out = data.frame( + time = rawdata$time, + x = rawdata$x, y = rawdata$y, z = rawdata$z, + light = light, + temperature = rawdata$temperature, + stringsAsFactors = TRUE + ) ))) } diff --git a/man/readGENEActiv.Rd b/man/readGENEActiv.Rd index b562263..5004897 100644 --- a/man/readGENEActiv.Rd +++ b/man/readGENEActiv.Rd @@ -35,12 +35,20 @@ } \details{ If only \code{start} page is defined then all data is read beyond - \code{start} until the end of the file is reached + \code{start} until the end of the file is reached. + + GENEActiv light measurements are calibrated according to the device model. + For GENEActiv 1.1, the existing light calibration is applied. + For GENEActiv 1.2 and above, an additional correction is applied to account for + the light sensor's non-linear scaling with graded resolution. This provides + greater accuracy at low light levels while supporting a higher range. + This correction was provided by ActivInsights Ltd, the manufacturer + of GENEActiv devices. } \value{ - + header: - + \item{serial_number}{Device serial number as extracted from file header} \item{firmware}{Firmware version} \item{tzone}{Time zone as extracted from file header} @@ -49,9 +57,9 @@ \item{ReadErrors}{matrix with battery voltage and corresponding timestamps} \item{numBlocksTotal}{matrix with battery voltage and corresponding timestamps} \item{StartTime}{Start time as extracted from file header} - + data.out: - + \item{time}{Unix time in seconds with decimal places for miliseconds} \item{x}{see \link{GENEActivReader}} \item{y}{see \link{GENEActivReader}} @@ -67,4 +75,4 @@ \author{ Patrick Bos Vincent T van Hees -} \ No newline at end of file +}