wadpac / GGIR

Code corresponding to R package GGIR
https://wadpac.github.io/GGIR/
Apache License 2.0
94 stars 60 forks source link

g.part5.addfirstwake fails if there are no SIBs in the first hours of recording #1198

Open jhmigueles opened 6 days ago

jhmigueles commented 6 days ago

if there aren't any SIBs detected within the start of the recording until the first noon, then GGIR triggers an error here that could be easily addressed. Usually this is not a concern because we expect SIBs there. In this dataset it was because recording started at 9am and they still wanted to include those recordings as they may run some analyses only using school window time (with this first window being of interest.

In lines 74-80 of the function, if there are no SIBs, then newWakeIndex is -Inf (line 76), and then in line 80 "ts$diur[1:newWakeIndex] = 1" triggers the error because it can not do 1:-Inf.