Skip to content

Commit

Permalink
Merge pull request #36 from wadpac/issue35_readlines
Browse files Browse the repository at this point in the history
Addressing #35 (concerning GENEActiv and Genea)
  • Loading branch information
vincentvanhees authored Jul 20, 2023
2 parents 8248608 + f47fef9 commit cb95332
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: GGIRread
Type: Package
Title: Wearable Accelerometer Data File Readers
Version: 0.2.8
Date: 2023-05-26
Version: 0.2.9
Date: 2023-07-20
Authors@R: c(person("Vincent T","van Hees",role=c("aut","cre"),
email="[email protected]"),
person(given = "Patrick",family = "Bos",
Expand Down
2 changes: 1 addition & 1 deletion R/readGENEActiv.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ readGENEActiv = function(filename, start = 0, end = 0, progress_bar = FALSE,

# Extract information from the fileheader
suppressWarnings({fh = readLines(filename, 69)})

# fh = fh[1:30]
SN = gsub(pattern = "Device Unique Serial Code:", replacement = "",
x = fh[grep(pattern = "Device Unique Serial Code", x = fh)[1]])
firmware = gsub(pattern = "Device Firmware Version:", replacement = "",
Expand Down
4 changes: 3 additions & 1 deletion R/readGenea.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ readGenea = function(filename, start = 0, end = 0) {
seek(fid, 0, origin = "start")
idstr = readChar(fid, 5, useBytes = TRUE)
if (all(idstr == "GENEA")) {
verstr = readLines(fid, n = 1)
readLines(fid, n = 1)
# verstr = readLines(fid, n = 1)
# seek(fid, 2, origin = "current")
## TODO: check file format version
header_items_raw = readBin(fid, "raw", n = 10 * onebyte)
## Find field ends (search for newline chars
Expand Down
5 changes: 3 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
\name{NEWS}
\title{News for Package \pkg{GGIRread}}
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\section{Changes in version 0.2.9 (release date:05-07-2023)}{
\section{Changes in version 0.2.9 (GitHub-only-release date:20-07-2023)}{
\itemize{
\item Revert bug fix to resample function in 0.2.8 and instead fixed the
\item Replace bug fix to resample function in 0.2.8 and instead fix the
issue inside readAxivity #33
\item Improvements to syntax for readGENEActiv and readGenea following R updates
}
}
\section{Changes in version 0.2.8 (release date:26-05-2023)}{
Expand Down
4 changes: 2 additions & 2 deletions man/GGIRread-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
\tabular{ll}{
Package: \tab GGIRread\cr
Type: \tab Package\cr
Version: \tab 0.2.8\cr
Date: \tab 2023-05-26\cr
Version: \tab 0.2.9\cr
Date: \tab 2023-07-20\cr
License: \tab LGPL (>= 2.0, < 3)\cr
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/GENEActivReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ int Bin2Dec(int n) {
int getLight(const std::string &hex) {
// input hex base is 16
int rawVal = std::stoll(hex, nullptr, 16);
int lux;
lux = Bin2Dec(rawVal >> 2);
return rawVal;
}

Expand Down Expand Up @@ -132,7 +130,6 @@ Rcpp::List GENEActivReader(std::string filename, std::size_t start = 0, std::siz
long blockTime = 0; // Unix millis
long lastvalue = 0; // Unix millis
double temperature = 0.0;
double volts = 0.0;
double freq = 0.0;
std::string data;
std::string timeFmtStr = "Page Time:%Y-%m-%d %H:%M:%S:";
Expand All @@ -155,7 +152,6 @@ Rcpp::List GENEActivReader(std::string filename, std::size_t start = 0, std::siz
try {
std::getline(input_file, header);
if (i == 3) {
std::tm tm = {};
std::stringstream ss(header);
int milliseconds;
ss >> milliseconds;
Expand Down Expand Up @@ -186,7 +182,6 @@ Rcpp::List GENEActivReader(std::string filename, std::size_t start = 0, std::siz
int yRaw = 0;
int zRaw = 0;
int lux = 0;
int last12 = 0;
double x = 0.0;
double y = 0.0;
double z = 0.0;
Expand Down

0 comments on commit cb95332

Please sign in to comment.