Skip to content

Commit

Permalink
addressing feedback Lena on #1049
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Feb 20, 2024
1 parent 8529c86 commit 3b6ba44
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions R/GGIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GGIR = function(mode = 1:5, datadir = c(), outputdir = c(),
# Set language to English while using GGIR
LC_TIME_backup = Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME", "C")
on.exit({Sys.setlocale("LC_TIME", LC_TIME_backup)}, add = TRUE)

#get input variables
input = list(...)
Expand Down Expand Up @@ -458,6 +459,4 @@ GGIR = function(mode = 1:5, datadir = c(), outputdir = c(),
verbose = TRUE)
}
}
# Reset langagues setting back to what they were4
Sys.setlocale("LC_TIME", LC_TIME_backup)
}
2 changes: 0 additions & 2 deletions R/convertEpochData.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ convertEpochData = function(datadir = c(), metadatadir = c(),
# Function to convert externally derived epoch data
# to a format that allows GGIR to process them as if they were part 1 output.

# Capture current local settings
Sys.setlocale("LC_TIME", "C") # set language to English
tz = params_general[["desiredtz"]]
epSizeShort = params_general[["windowsizes"]][1]
epSizeLong = params_general[["windowsizes"]][2]
Expand Down
1 change: 0 additions & 1 deletion R/g.getstarttime.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ g.getstarttime = function(datafile, data, mon, dformat, desiredtz, configtz = NU
}
}
expectedformat = paste0('%',splitformat[1],sepa,'%',splitformat[2],sepa,'%',splitformat[3],' %H:%M:%S')
Sys.setlocale("LC_TIME", "C") # set language to English because that is what we use elsewhere in GGIR
starttime = as.POSIXct(starttime, format = expectedformat, tz = configtz)
starttime = as.POSIXlt(starttime, tz = desiredtz)
} else {
Expand Down
1 change: 1 addition & 0 deletions R/g.part1.R
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ g.part1 = function(datadir = c(), metadatadir = c(), f0 = 1, f1 = c(), myfun = c
"MONITOR", "FORMAT"),
envir = as.environment(asNamespace("GGIR"))
)
parallel::clusterEvalQ(cl, Sys.setlocale("LC_TIME", "C"))

Check warning on line 374 in R/g.part1.R

View check run for this annotation

Codecov / codecov/patch

R/g.part1.R#L374

Added line #L374 was not covered by tests
doParallel::registerDoParallel(cl)
} else {
# Don't process in parallel if only one core
Expand Down
3 changes: 1 addition & 2 deletions R/g.part2.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ g.part2 = function(datadir = c(), metadatadir = c(), f0 = c(), f1 = c(),
params_phyact = c(), params_output = c(), params_general = c(),
path, ms2.out, foldername, fullfilenames, folderstructure, referencefnames,
daySUMMARY, pdffilenumb, pdfpagecount, csvfolder, cnt78, verbose) {
# Set language to English while using GGIR
Sys.setlocale("LC_TIME", "C")
Nappended = I_list = tail_expansion_log = NULL
if (length(ffdone) > 0) {
if (length(which(ffdone == as.character(unlist(strsplit(fnames[i], "eta_"))[2]))) > 0) {
Expand Down Expand Up @@ -277,6 +275,7 @@ g.part2 = function(datadir = c(), metadatadir = c(), f0 = c(), f1 = c(),
varlist = c(unclass(lsf.str(envir = asNamespace("GGIR"), all = T)),
"MONITOR", "FORMAT"),
envir = as.environment(asNamespace("GGIR")))
parallel::clusterEvalQ(cl, Sys.setlocale("LC_TIME", "C"))

Check warning on line 278 in R/g.part2.R

View check run for this annotation

Codecov / codecov/patch

R/g.part2.R#L278

Added line #L278 was not covered by tests
doParallel::registerDoParallel(cl)
} else {
# Don't process in parallel if only one core
Expand Down
3 changes: 1 addition & 2 deletions R/g.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ g.part5 = function(datadir = c(), metadatadir = c(), f0=c(), f1=c(),
fnames.ms3, sleeplog, logs_diaries,
extractfilenames, referencefnames, folderstructure,
fullfilenames, foldername, ffdone, verbose) {
# Set language to English while using GGIR
Sys.setlocale("LC_TIME", "C")
tail_expansion_log = NULL
fnames.ms1 = dir(paste(metadatadir, "/meta/basic", sep = ""))
fnames.ms2 = dir(paste(metadatadir, "/meta/ms2.out", sep = ""))
Expand Down Expand Up @@ -672,6 +670,7 @@ g.part5 = function(datadir = c(), metadatadir = c(), f0=c(), f1=c(),
varlist = c(unclass(lsf.str(envir = asNamespace("GGIR"), all = T)),
"MONITOR", "FORMAT"),
envir = as.environment(asNamespace("GGIR")))
parallel::clusterEvalQ(cl, Sys.setlocale("LC_TIME", "C"))

Check warning on line 673 in R/g.part5.R

View check run for this annotation

Codecov / codecov/patch

R/g.part5.R#L673

Added line #L673 was not covered by tests
doParallel::registerDoParallel(cl)
} else {
# Don't process in parallel if only one core
Expand Down

0 comments on commit 3b6ba44

Please sign in to comment.