diff --git a/NEWS.md b/NEWS.md index bd3017f51..6995aea0a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,8 @@ - Part 1: Tidied up code in internal function detect_nonwear_clipping.R to ease future reviews. #1212 +- Part 4: Undo changes to 3 line in g.part4 function from commit 3b9e2b7 (in between 3.1-1 and 3.1-2 release in June 2024) which broke functionality for handling sleep that starts before the double DST hour in the autumn and ends inside it. #1221 + # CHANGES IN GGIR VERSION 3.1-4 - Part 3: Update threshold used for HorAngle to 60 degree, and auto-setting HASPT.ignore.invalid to NA when NotWorn guider is used. #1186 diff --git a/R/g.part4.R b/R/g.part4.R index e54482bb9..24fcbbfe8 100644 --- a/R/g.part4.R +++ b/R/g.part4.R @@ -814,9 +814,10 @@ g.part4 = function(datadir = c(), metadatadir = c(), f0 = f0, f1 = f1, # in the autumn and ends inside the dst hour negval = which(nocs < 0) if (length(negval) > 0) { - kk0 = as.numeric(spocum.t$start[negval]) # episode onsets - kk1 = as.numeric(spocum.t$end[negval]) + 1 # episode endings - nocs[negval] = kk1 - kk0 + kk0 = as.numeric(spocum.t$start[which(spocum.t$overlapGuider == 1)]) # episode onsets + kk1 = as.numeric(spocum.t$end[which(spocum.t$overlapGuider == 1)]) # episode endings + kk1[negval] = kk1[negval] + 1 + nocs = kk1 - kk0 } if (length(nocs) > 0) { spocum.t.dur.noc = sum(nocs)