In function g.sib.det we consider the first night if it starts after midnight and before 4am and refer to this as night 0.
However, this goes wrong when there is only one midnight in the recording. In that case countmidn is 1 and
it sets firstmidnighti to 1, by which the first4am < firstmidnighti later on in the function returns FALSE.
To fix this we need to set firstmidnighti = midnightsi[1].
In function
g.sib.det
we consider the first night if it starts after midnight and before 4am and refer to this as night 0. However, this goes wrong when there is only one midnight in the recording. In that casecountmidn
is 1 and it setsfirstmidnighti
to 1, by which thefirst4am < firstmidnighti
later on in the function returns FALSE.To fix this we need to set
firstmidnighti = midnightsi[1]
.