From fbf0656bdd3f56009e10121744da2123e3f1cf9f Mon Sep 17 00:00:00 2001 From: Matthias Mittner Date: Mon, 22 Mar 2021 14:46:23 +0100 Subject: [PATCH] fix blink detection closes #15 --- pypillometry/preproc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pypillometry/preproc.py b/pypillometry/preproc.py index f47bcba..92e177a 100644 --- a/pypillometry/preproc.py +++ b/pypillometry/preproc.py @@ -142,6 +142,8 @@ def detect_blinks_zero(sy, min_duration, blink_val=0): x=np.r_[0, np.diff((sy==blink_val).astype(np.int))] starts=np.where(x==1)[0] ends=np.where(x==-1)[0]-1 + if sy[0]==blink_val: ## first value missing? + starts=np.r_[0,starts] if ends.size!=starts.size: ## is the first start earlier than the first end? if starts[0]>ends[0]: